-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can react native be bundled without regenerator-runtime? #187
Comments
@sjmueller i'm using the below babelrc to avoid regenerator (search for {
env: {
production: {
//presets: ['react-native']
plugins: [
'syntax-async-functions',
'syntax-class-properties',
'syntax-trailing-function-commas',
'transform-class-properties',
'transform-es2015-function-name',
'transform-es2015-arrow-functions',
'transform-es2015-block-scoping',
'transform-es2015-classes',
'transform-es2015-computed-properties',
'check-es2015-constants',
'transform-es2015-destructuring',
'transform-es2015-parameters',
'transform-es2015-shorthand-properties',
'transform-es2015-spread',
'transform-es2015-template-literals',
'transform-es2015-literals',
'transform-flow-strip-types',
'transform-object-rest-spread',
'transform-react-display-name',
'transform-react-jsx',
['transform-regenerator', {
asyncGenerators: true, // true by default
generators: true, // true by default
async: true // true by default
}],
['transform-async-to-module-method', {
module: 'bluebird',
method: 'coroutine'
}],
['transform-es2015-for-of', { loose: true }],
]
},
development: {
plugins: [
'syntax-async-functions',
'syntax-class-properties',
'syntax-trailing-function-commas',
'transform-class-properties',
'transform-es2015-function-name',
'transform-es2015-arrow-functions',
'transform-es2015-block-scoping',
'transform-es2015-classes',
'transform-es2015-computed-properties',
'check-es2015-constants',
'transform-es2015-destructuring',
'transform-es2015-parameters',
'transform-es2015-shorthand-properties',
'transform-es2015-spread',
'transform-es2015-template-literals',
'transform-es2015-literals',
'transform-flow-strip-types',
'transform-object-rest-spread',
'transform-react-display-name',
'transform-react-jsx',
['transform-regenerator', {
asyncGenerators: true, // true by default
generators: false, // true by default
async: true // true by default
}],
['transform-async-to-module-method', {
module: 'bluebird',
method: 'coroutine'
}],
['transform-es2015-for-of', { loose: true }],
]
}
}
} |
@mvayngrib thanks for this, does it work with Babel 7 and react 0.57? We’ve upgraded and the babelrc has changed significantly as a result. |
@sjmueller I've been working on an alternative Babel config using the "env" preset to get JS targeted based on our minimum supported iOS/Android OS. This is what I've come up with so far, targeting iOS 10.3+ and Android with the alternative JavaScriptCore runtime.
I had to leave in the |
@sjmueller sorry, haven't tried, i'm on RN 0.55.4 @newyankeecodeshop cool, will give it a try when we upgrade! I haven't seen this |
@mvayngrib fyi #364. |
@angly-cat thx! |
Now that we have an updated JavaScriptCode by default, shouldn't |
@brunolemos RN still supports iOS 9 and 10.x before 10.3, which do not have |
@newyankeecodeshop so regenerator transformations can be at least completely dropped for Android builds, correct? |
I'm working on a very large react-native application that is experiencing performance problems, and would also love to drop regenerator transforms for our android builds and see if that does anything. Very interested if anyone else has done this, otherwise I might try it myself in a few weeks. |
@lebedev @newyankeecodeshop
|
@eliot1019 |
Just heads up that while removing regenerator from the preset works just fine on ios using JSC, it does NOT work on Android when using Hermes. It doesn't even work when you transform async functions to generators (@babel/plugin-transform-async-to-generator). So be warned. |
Closed by #789 |
Debugging is quite painful with the regenerator runtime polyfill, yet iOS has supported async/await since 10.3 (and chrome for a very long time).
I've tried creating my own
.babelrc
and removing them, I've tried adding an exclude section, and I've even tried removing locally frombabel-preset-react-native
. Nothing seems to work! Is there any way to prevent react native and/or metro bundler from using it?The text was updated successfully, but these errors were encountered: