Skip to content

Commit

Permalink
Revert a windows dir normalization patch that is no longer needed aft…
Browse files Browse the repository at this point in the history
…er upgrading babel

Reviewed By: rubennorte

Differential Revision: D8913980

fbshipit-source-id: 1adccc2804addbbeabc79c5f2000872a6e011fb4
  • Loading branch information
Peter van der Zee authored and facebook-github-bot committed Jul 19, 2018
1 parent 9b91c25 commit 0b70c9a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/metro-babel-register/src/babel-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ function config(onlyList) {
* have the same name as one of `BABEL_ENABLED_PATHS`.
*/
function buildRegExps(basePath, dirPaths) {
// Babel `only` option works with forward slashes in the RegExp so replace
// them for Windows (only v7 beta 44 ~ 52 temporarily changes this behavior)
return dirPaths.map(
folderPath =>
// Babel cares about windows/unix paths since v7b44
// https://github.com/babel/babel/issues/8184
// basePath + path.sep + dirPath/dirRegex
// /home/name/webroot/js + / + relative/path/to/exclude
// c:\home\name\webroot\js + \ + relative\path\to\exclude
folderPath instanceof RegExp
? new RegExp(
`^${escapeRegExp(path.resolve(basePath, '.') + path.sep)}${
folderPath.source // This is actual regex, don't escape it
}`,
folderPath.flags,
`^${escapeRegExp(
path.resolve(basePath, '.').replace(/\\/g, '/'),
)}/${folderPath.source}`,
)
: new RegExp('^' + escapeRegExp(path.resolve(basePath, folderPath))),
: new RegExp(
`^${escapeRegExp(
path.resolve(basePath, folderPath).replace(/\\/g, '/'),
)}`,
),
);
}

Expand Down

0 comments on commit 0b70c9a

Please sign in to comment.