Skip to content

Commit

Permalink
Remove global babelHelpers and regenerator (#21283)
Browse files Browse the repository at this point in the history
Summary:
Follow up to facebook/metro@8932a9c

Babel helpers and regenerator runtime will be imported automatically from `babel/runtime`. We still need to add the global regeneratorRuntime for jest tests since we disable babel-runtime currently.
Pull Request resolved: #21283

Reviewed By: mjesun

Differential Revision: D10010963

Pulled By: rafeca

fbshipit-source-id: da5e23dd901f8f8940d46816b4fc9290d0e28c76
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Sep 26, 2018
1 parent 544adca commit 458d56c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions IntegrationTests/RCTRootViewIntegrationTestApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

'use strict';

require('regenerator-runtime/runtime');

const React = require('react');
const ReactNative = require('react-native');

Expand Down
1 change: 0 additions & 1 deletion jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ jest
})
.mock('ensureComponentIsNative', () => () => true);

const mockEmptyObject = {};
const mockNativeModules = {
AlertManager: {
alertWithArgs: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"react": "16.5.0"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"absolute-path": "^0.0.0",
"art": "^0.10.0",
"base64-js": "^1.1.2",
Expand Down Expand Up @@ -203,7 +204,6 @@
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/runtime": "^7.0.0",
"async": "^2.4.0",
"babel-eslint": "9.0.0",
"babel-generator": "^6.26.0",
Expand Down
1 change: 0 additions & 1 deletion rn-get-polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ module.exports = () => [
require.resolve('./Libraries/polyfills/Array.prototype.es6.js'),
require.resolve('./Libraries/polyfills/Array.es6.js'),
require.resolve('./Libraries/polyfills/Object.es7.js'),
require.resolve('./Libraries/polyfills/babelHelpers.js'),
];

2 comments on commit 458d56c

@janicduplessis
Copy link
Contributor Author

@janicduplessis janicduplessis commented on 458d56c Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rafeca I noticed you did not include the change that removes the global regenerator polyfill. I think this might cause it to get included it twice in the bundle when using @babel/transform-runtime. I think the ideal solution would be to remove it from InitializeCore.js and include it as a polyfill at fb (in the internal rn-get-polyfills.js that has the babelHelpers polyfill).

Would that work?

The alternative solution is to make @babel/transform-runtime not transform regenerator and keep using the global for OSS too.

@rafeca
Copy link
Contributor

@rafeca rafeca commented on 458d56c Oct 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @janicduplessis ! Since the regenerator runtime is added lazily once it's used we cannot add it as a normal polyfill (it needs to be able to require other modules).

@ejanzer is doing some internal changes that will allow us to inject the regenerator runtime in a different way, once we have this done we should be able to remove it from InitializeCore

Please sign in to comment.