Skip to content

Commit 81f6c5b

Browse files
authored
Merge pull request #14718 from webpack/fix-managed-path
fix regexp in managed paths
2 parents 789e585 + adea157 commit 81f6c5b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/config/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ const applySnapshotDefaults = (snapshot, { production, futureDefaults }) => {
383383
return [path.resolve(match[1], "unplugged")];
384384
}
385385
} else {
386-
const match = /^(.+?[\\/]node_modules)[\\/]/.exec(
386+
const match = /^(.+?[\\/]node_modules[\\/])/.exec(
387387
// eslint-disable-next-line node/no-extraneous-require
388388
require.resolve("watchpack")
389389
);

test/Defaults.unittest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ describe("Defaults", () => {
599599
},
600600
"immutablePaths": Array [],
601601
"managedPaths": Array [
602-
"<cwd>/node_modules",
602+
"<cwd>/node_modules/",
603603
],
604604
"module": Object {
605605
"timestamp": true,
@@ -1952,7 +1952,7 @@ describe("Defaults", () => {
19521952
- "hashFunction": "md4",
19531953
+ "hashFunction": "xxhash64",
19541954
@@ ... @@
1955-
- "<cwd>/node_modules",
1955+
- "<cwd>/node_modules/",
19561956
+ /^(.+?[\\\\/]node_modules[\\\\/])/,
19571957
`)
19581958
);

0 commit comments

Comments
 (0)