Skip to content

Commit ab9f6ee

Browse files
committed
chrome workaround for eval-source-maps
breakpoints now work fine
1 parent 2b26cbb commit ab9f6ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/EvalSourceMapDevToolModuleTemplatePlugin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
1010
class EvalSourceMapDevToolModuleTemplatePlugin {
1111
constructor(compilation, options) {
1212
this.compilation = compilation;
13-
this.sourceMapComment = options.append || "//# sourceMappingURL=[url]";
13+
this.sourceMapComment = options.append || "//# sourceURL=[module]\n//# sourceMappingURL=[url]";
1414
this.moduleFilenameTemplate = options.moduleFilenameTemplate || "webpack:///[resource-path]?[hash]";
1515
this.options = options;
1616
}
@@ -61,13 +61,14 @@ class EvalSourceMapDevToolModuleTemplatePlugin {
6161
sourceMap.sourceRoot = options.sourceRoot || "";
6262
sourceMap.file = `${module.id}.js`;
6363

64-
const footer = self.sourceMapComment.replace(/\[url\]/g, `data:application/json;charset=utf-8;base64,${new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64")}`); //eslint-disable-line
64+
const footer = self.sourceMapComment.replace(/\[url\]/g, `data:application/json;charset=utf-8;base64,${new Buffer(JSON.stringify(sourceMap), "utf8").toString("base64")}`) + //eslint-disable-line
65+
`\n//# sourceURL=webpack-internal:///${module.id}\n`; // workaround for chrome bug
6566
source.__EvalSourceMapDevToolData = new RawSource(`eval(${JSON.stringify(content + footer)});`);
6667
return source.__EvalSourceMapDevToolData;
6768
});
6869
moduleTemplate.plugin("hash", function(hash) {
6970
hash.update("eval-source-map");
70-
hash.update("1");
71+
hash.update("2");
7172
});
7273
}
7374
}

0 commit comments

Comments
 (0)