mirror of
https://github.com/status-im/react-native.git
synced 2025-01-13 19:15:05 +00:00
Fix babel only regexp on windows
Summary: cli / packager was broken on Windows after 28f1c67ced5f082d92ba674e7e8bd233f4ff29ca. 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) {
|
||||
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…
x
Reference in New Issue
Block a user