Fix babel only regexp on windows
Summary:
cli / packager was broken on Windows after 28f1c67ced
.
Babel `only` regexp option requires paths to use forward slashes only but `__dirname` will use backslashes on windows. This simply adds a replace to normalize to forward slashes.
cc jeanlauliac cpojer
Closes https://github.com/facebook/react-native/pull/11850
Reviewed By: cpojer
Differential Revision: D4409143
Pulled By: jeanlauliac
fbshipit-source-id: a705236630959f762e53100299ab073ec9a29ee1
This commit is contained in:
parent
c68a708621
commit
6b1bc4ad74
|
@ -26,7 +26,9 @@ const BABEL_ENABLED_PATHS = [
|
||||||
*/
|
*/
|
||||||
function buildRegExps(basePath, dirPaths) {
|
function buildRegExps(basePath, dirPaths) {
|
||||||
return dirPaths.map(folderPath =>
|
return dirPaths.map(folderPath =>
|
||||||
new RegExp(`^${escapeRegExp(path.resolve(basePath, folderPath))}`)
|
// Babel `only` option works with forward slashes in the RegExp so replace
|
||||||
|
// backslashes for Windows.
|
||||||
|
new RegExp(`^${escapeRegExp(path.resolve(basePath, folderPath).replace(/\\/g, '/'))}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue