Unbreak packager on oss master
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
This commit is contained in:
parent
42d756310a
commit
32b62ef055
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2015-present, Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD-style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var _only = [];
|
||||||
|
|
||||||
|
module.exports = function(onlyList) {
|
||||||
|
_only = _only.concat(onlyList);
|
||||||
|
require('babel-core/register')({only: _only});
|
||||||
|
};
|
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('babel-core/register')();
|
require('../../babelRegisterOnly')([/react-packager\/src/]);
|
||||||
|
|
||||||
useGracefulFs();
|
useGracefulFs();
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// trigger babel-core/register
|
require('../babelRegisterOnly')([/private-cli\/src/]);
|
||||||
require('../packager/react-packager');
|
|
||||||
|
|
||||||
var cli = require('./src/cli');
|
var cli = require('./src/cli');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
Loading…
Reference in New Issue