Skip to content

Commit efda81b

Browse files
Add support for windows-style pathnames (with backslashes)
1 parent 642294a commit efda81b

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

loader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ let id = 0;
77
const NS = path.dirname(fs.realpathSync(__filename));
88

99
const getLoaderName = path => {
10-
const nodeModuleName = /\/node_modules\/([^\/]+)/.exec(path);
10+
const standardPath = path.replace(/\\/g, "/");
11+
const nodeModuleName = /\/node_modules\/([^\/]+)/.exec(standardPath);
1112
return (nodeModuleName && nodeModuleName[1]) || "";
1213
};
1314

@@ -36,7 +37,7 @@ module.exports.pitch = function() {
3637
});
3738
return asyncCallback.apply(this, arguments);
3839
};
39-
}.bind(this)
40+
}.bind(this),
4041
});
4142

4243
callback({

utils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ module.exports.getLoaderNames = loaders =>
5151
? loaders
5252
.map(l => l.loader || l)
5353
.map(l =>
54-
l.replace(
55-
/^.*\/node_modules\/(@[a-z0-9][\w-.]+\/[a-z0-9][\w-.]*|[^\/]+).*$/,
56-
(_, m) => m
57-
)
54+
l
55+
.replace(/\\/g, "/")
56+
.replace(
57+
/^.*\/node_modules\/(@[a-z0-9][\w-.]+\/[a-z0-9][\w-.]*|[^\/]+).*$/,
58+
(_, m) => m
59+
)
5860
)
5961
.filter(l => !l.includes("speed-measure-webpack-plugin"))
6062
: ["modules with no loaders"];

0 commit comments

Comments
 (0)