Skip to content

Commit

Permalink
Fix path regex match bug (#3686)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Norris1z authored and Timer committed Jan 4, 2018
1 parent 12120f6 commit 8cae659
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/react-dev-utils/ignoredFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
};

0 comments on commit 8cae659

Please sign in to comment.