For AI agents: the complete documentation index is available at https://rspack.rs/llms.txt, the full documentation bundle is available at https://rspack.rs/llms-full.txt, and this page is available as Markdown at https://rspack.rs/plugins/eval-source-map-dev-tool-plugin.md.
close

EvalSourceMapDevToolPlugin

This plugin enables more fine grained control of source map generation. It is also enabled automatically by certain settings of the devtool configuration option.

Examples

Basic use case

You can use the following code to replace the configuration option devtool: eval-source-map with an equivalent custom plugin configuration:

rspack.config.mjs
import { rspack } from '@rspack/core';

export default {
  devtool: false,
  plugins: [new rspack.EvalSourceMapDevToolPlugin({})],
};

Exclude vendor maps

The test, include, and exclude options match module resource paths, rather than output bundle filenames. The following example excludes source maps for modules in node_modules:

new rspack.EvalSourceMapDevToolPlugin({
  exclude: /[\\/]node_modules[\\/]/,
});

Options

test

  • Type: string RegExp [string, RegExp]

Generate source maps for modules whose resource paths match the given value. By default, this option does not restrict which modules are included.

include

  • Type: string RegExp [string, RegExp]

Include source maps for module paths that match the given value.

exclude

  • Type: string RegExp [string, RegExp]

Exclude modules that match the given value from source map generation.

module

  • Type: boolean

Indicates whether loaders should generate source maps (defaults to true).

columns

  • Type: boolean

Indicates whether column mappings should be used (defaults to true).

This page is adapted from webpack documentation under the CC BY 4.0, with modifications.