From cc4ab480572fee9bc2c59aed8fafe50894903cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Bigio?= Date: Thu, 8 Oct 2015 17:36:12 -0700 Subject: [PATCH] Unbreak packager on oss master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: @​public This was a hard one, bare with me on the full story of what happened. We recently started writting additional JS scripts in ES6 for the cli. These code needs to be transformed by babel before we execute it as we don't run node with `--harmony`. To do so we removed the `only` attribute on the `babel-register`. Turns out this broke the packager on oss as if no `only` not `ignore` parameter is specified babel will ignore `node_modules`. Since on oss when a project is created `react-native-github` is located inside of `node_modules` we started getting syntax errors. The fix is to include separately all the different paths we need to make sure babel transforms each of them. We cannot simply have a single `babel-core/register` as we need to include paths that belong both to oss and internal only. So, we need to have multiple `register` invocations. Since babel does not accumulate the `only` you send on every invocation we need to build a small wrapper to do so. Reviewed By: @frantic Differential Revision: D2522426 fb-gh-sync-id: 379a7bb169c7d5cb3002268742de269238bba766 --- react-packager/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-packager/index.js b/react-packager/index.js index 27c4de5b..b435a57a 100644 --- a/react-packager/index.js +++ b/react-packager/index.js @@ -8,7 +8,7 @@ */ 'use strict'; -require('babel-core/register')(); +require('../../babelRegisterOnly')([/react-packager\/src/]); useGracefulFs();