Skip to content

Commit

Permalink
Fix path regex match bug (facebook#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 Pavel Zhytko committed Jul 10, 2018
1 parent d9bfbb6 commit fd3154b
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 fd3154b

Please sign in to comment.