Update metro-react-native-babel-preset to remove unnecessary plugins with new JSC
See original GitHub issueDo you want to request a feature or report a bug?
(This is more of an improvement request. I’m happy to help with the corresponding implementation.)
Since 0.59.0-rc0
, react-native
added support for a modern JSC for Android. This is super great because it means that a lot of the babel transforms/plugins used in the preset are no longer required.
List of unnecessary babel plugins:
@babel/plugin-transform-block-scoping
@babel/plugin-transform-computed-properties
@babel/plugin-transform-destructuring
@babel/plugin-transform-function-name
@babel/plugin-transform-literals
@babel/plugin-transform-parameters
@babel/plugin-transform-shorthand-properties
@babel/plugin-transform-regenerator
(Only required for iOS 10)@babel/plugin-transform-arrow-functions
@babel/plugin-transform-classes
@babel/plugin-transform-for-of
@babel/plugin-transform-spread
@babel/plugin-transform-template-literals
@babel/plugin-transform-exponentiation-operator
(Only required for iOS 10)@babel/plugin-transform-object-assign
A more thorough research of how I discovered these is available in this twitter thread.
What is the current behavior?
Currently all the above plugins are applied on the JS source, some selectively, some always.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
This is not a bug but is a potential opportunity for bundle size improvements.
What is the expected behavior?
It would be great if we remove plugins which are already supported in the minimum JSC version available on iOS and Android.
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
N/A
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:11 (5 by maintainers)
Top GitHub Comments
Please fix this damn problem. I’m almost at the point where I have to fork metro to be productive. That’s terrible.
Is there something coming down the pipe that’s going to replace metro? Someone from Facebook, please respond. I know you’re reading!
@ariccio I think you’re barking up the wrong tree 😦.
This issue may be open, but it seems like it’s definitely stale and hasn’t been caught by a bot.
If you look at all the linked issues that seem to take the stuff being discussed further, they have been shuttered due to FB being dead silent about this, sadly.