Skip to content

Commit c9331d9

Browse files
committed
fixed location info for minimizing
1 parent c32b233 commit c9331d9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/optimize/UglifyJsPlugin.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ UglifyJsPlugin.prototype.apply = function(compiler) {
2020
var options = this.options;
2121
var requestShortener = this.requestShortener;
2222
compiler.plugin("compilation", function(compilation) {
23+
compilation.plugin("build-module", function(module) {
24+
// to get detailed location info about errors
25+
module.useSourceMap = true;
26+
});
2327
compilation.plugin("optimize-chunk-assets", function(chunks, callback) {
2428
var files = [];
2529
chunks.forEach(function(chunk) {
@@ -41,11 +45,11 @@ UglifyJsPlugin.prototype.apply = function(compiler) {
4145
return;
4246
}
4347
var inputSourceMap = compilation.assets[file].map();
44-
var sourceMap = new SourceMapConsumer(inputSourceMap)
48+
var sourceMap = new SourceMapConsumer(inputSourceMap);
4549
uglify.AST_Node.warn_function = function(warning) {
4650
var match = /\[.+:([0-9]+),([0-9]+)\]/.exec(warning);
47-
var line = match[1];
48-
var column = match[2];
51+
var line = +match[1];
52+
var column = +match[2];
4953
var original = sourceMap.originalPositionFor({
5054
line: line,
5155
column: column

0 commit comments

Comments
 (0)