mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
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
This commit is contained in:
7
packages/react-dev-utils/ignoredFiles.js
vendored
7
packages/react-dev-utils/ignoredFiles.js
vendored
@@ -8,12 +8,13 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const escape = require('escape-string-regexp');
|
||||
|
||||
module.exports = function ignoredFiles(appSrc) {
|
||||
return new RegExp(
|
||||
`^(?!${path
|
||||
.normalize(appSrc + '/')
|
||||
.replace(/[\\]+/g, '/')}).+/node_modules/`,
|
||||
`^(?!${escape(
|
||||
path.normalize(appSrc + '/').replace(/[\\]+/g, '/')
|
||||
)}).+/node_modules/`,
|
||||
'g'
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user