Skip to content

Commit 8cae659

Browse files
Norris1zTimer
authored andcommitted
Fix path regex match bug (#3686)
* Fix path regex match bug * Use the escape-string-regexp package to escape regex characters * Remove redundant character escape from path * Add removed escape of backslashes
1 parent 12120f6 commit 8cae659

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/react-dev-utils/ignoredFiles.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
'use strict';
99

1010
const path = require('path');
11+
const escape = require('escape-string-regexp');
1112

1213
module.exports = function ignoredFiles(appSrc) {
1314
return new RegExp(
14-
`^(?!${path
15-
.normalize(appSrc + '/')
16-
.replace(/[\\]+/g, '/')}).+/node_modules/`,
15+
`^(?!${escape(
16+
path.normalize(appSrc + '/').replace(/[\\]+/g, '/')
17+
)}).+/node_modules/`,
1718
'g'
1819
);
1920
};

0 commit comments

Comments
 (0)