EvalSourceMapDevToolPlugin
这个插件可以更细致地控制源映射文件(source map)的生成。在特定的 devtool 配置选项设置下,它也会被自动启用。
示例
基本使用
你可以使用以下代码来替换配置选项 devtool: eval-source-map,使用等效的自定义插件配置:
rspack.config.mjs
排除 Vendor maps
test、include 和 exclude 匹配的是模块资源路径,而不是输出文件名。以下示例排除 node_modules 中模块的 source map:
选项
test
- 类型:
stringRegExp[string, RegExp]
为资源路径与给定值匹配的模块生成 source map。默认情况下,此选项不限制包含哪些模块。
include
- 类型:
stringRegExp[string, RegExp]
使路径与该值匹配的模块生成 source map。
exclude
- 类型:
stringRegExp[string, RegExp]
使匹配该值的模块不生成 source map。
module
- 类型:
boolean
指示 loader 是否应生成 source map(默认为 true)。
columns
- 类型:
boolean
指示是否应该使用列映射(默认为 true)。
本页改编自 webpack 文档,遵循 CC BY 4.0,且已作修改。

