Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Enable @babel/preset-env's ShippedProposals mode #1580

Merged
merged 1 commit into from Jun 8, 2020
Merged

Enable @babel/preset-env's ShippedProposals mode #1580

merged 1 commit into from Jun 8, 2020

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Jun 6, 2020

Enabling this means that preset-env now injects additional plugins for any features that aren't yet stage 3, but have been shipped in at least one browser (meaning they are as good as finalised):
https://babeljs.io/docs/en/babel-preset-env#shippedproposals

Using this new mode also means we no longer need to manually include the @babel/plugin-proposal-class-properties plugin, since it's included in the shipped proposals list as of Babel 7.10.0:
babel/babel#11451

This change does mean that @babel/plugin-proposal-class-properties will be used in strict mode rather than loose mode if browsers in the target list do not support it (so slight bundle size increase), however that seems like a reasonable trade-off to:

  • ensure there are no surprises when targets change and the transform plugin stops being used
  • reduce amount of Neutrino config boilerplate

...especially given several browsers already support it natively:
https://github.com/babel/babel/blob/426acf336e0ab8402714e25b12edf1a61a735ce5/packages/babel-compat-data/data/plugins.json#L13-L19

I've tested this change locally to ensure class properties do indeed continue to work (wish we had a better test suite for sample functionality that wasn't just the create-project templates, where we really don't want to add complexity since the examples should be simple).

Enabling this means that preset-env now injects additional plugins for
any features that aren't yet stage 3, but have been shipped in at least
one browser (meaning they are as good as finalised):
https://babeljs.io/docs/en/babel-preset-env#shippedproposals

Using this new mode also means we no longer need to manually include the
`@babel/plugin-proposal-class-properties` plugin, since it's included
in the shipped proposals list as of Babel 7.10.0:
babel/babel#11451
@edmorley edmorley self-assigned this Jun 6, 2020
@edmorley edmorley requested a review from a team June 6, 2020 12:42
Copy link
Member

@eliperelman eliperelman left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!

@edmorley edmorley merged commit 230e815 into neutrinojs:master Jun 8, 2020
@edmorley edmorley deleted the babel-shipped-proposals branch June 8, 2020 19:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants