Skip to content

Commit 6970103

Browse files
authored
Merge pull request webpack#6627 from Hoten/feat-uglifyjs-default-sourcemap
defaults: set source map option for UglifyJs to true if SourceMapDevToolPlugin exists
2 parents f916fc0 + 17d03c1 commit 6970103

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/WebpackOptionsDefaulter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,14 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
264264
apply: compiler => {
265265
// Lazy load the uglifyjs plugin
266266
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
267+
const SourceMapDevToolPlugin = require("./SourceMapDevToolPlugin");
267268
new UglifyJsPlugin({
268269
cache: true,
269270
parallel: true,
270-
sourceMap: options.devtool && /source-?map/.test(options.devtool)
271+
sourceMap:
272+
(options.devtool && /source-?map/.test(options.devtool)) ||
273+
(options.plugins &&
274+
options.plugins.some(p => p instanceof SourceMapDevToolPlugin))
271275
}).apply(compiler);
272276
}
273277
}

0 commit comments

Comments
 (0)