Skip to content

Commit

Permalink
Fix babel only regexp on windows
Browse files Browse the repository at this point in the history
Summary:
cli / packager was broken on Windows after 28f1c67.

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 #11850

Reviewed By: cpojer

Differential Revision: D4409143

Pulled By: jeanlauliac

fbshipit-source-id: a705236630959f762e53100299ab073ec9a29ee1
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Jan 12, 2017
1 parent c68a708 commit 6b1bc4a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion setupBabel.js
Expand Up @@ -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, '/'))}`)
); );
} }


Expand Down

0 comments on commit 6b1bc4a

Please sign in to comment.