Skip to content

Commit 348c38b

Browse files
committed
allow missing source in SourceMap webpack#954
1 parent af22dce commit 348c38b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎lib/ModuleFilenameHelpers.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function asRegExp(test) {
4747
}
4848

4949
ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFilenameTemplate, requestShortener) {
50+
if(!module) module = "";
5051
if(typeof module === "string") {
5152
var shortIdentifier = requestShortener.shorten(module);
5253
var identifier = shortIdentifier;

‎lib/SourceMapDevToolPlugin.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ SourceMapDevToolPlugin.prototype.apply = function(compiler) {
9191
}, function(ai, bi) {
9292
var a = allModules[ai];
9393
var b = allModules[bi];
94-
a = typeof a === "string" ? a : a.identifier();
95-
b = typeof b === "string" ? b : b.identifier();
94+
a = !a ? "" : typeof a === "string" ? a : a.identifier();
95+
b = !b ? "" : typeof b === "string" ? b : b.identifier();
9696
return a.length - b.length;
9797
});
9898
allModuleFilenames = ModuleFilenameHelpers.replaceDuplicates(allModuleFilenames, function(filename, i, n) {

0 commit comments

Comments
 (0)