Skip to content

Commit a9810a3

Browse files
authored
Support Windows directory separators (#3)
* Support Windows path system which contains backslashes * Use `path.sep` to get system default Authored by: Thierry Parent <tparent@absolunet.com>
1 parent 00f06c9 commit a9810a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
const mix = require("laravel-mix");
2+
const path = require('path');
23

34
const escapeRegExp = (str) => str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
5+
const slashPattern = `\\${path.sep}`;
46

57
/**
68
* Babel-transpile dependencies inside `node_modules`
@@ -76,7 +78,7 @@ class TranspileNodeModules {
7678
return /node_modules/;
7779
} else {
7880
const includeModules = transpile.map(escapeRegExp).join("|");
79-
return new RegExp(`node_modules/(?!(${includeModules})/)`);
81+
return new RegExp(`node_modules${slashPattern}(?!(${includeModules})${slashPattern})`);
8082
}
8183
}
8284
}

0 commit comments

Comments
 (0)