-
Notifications
You must be signed in to change notification settings - Fork 361
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
fix: use @babel/preset-env with bugfixes for modern builds #702
Conversation
🦋 Changeset is good to goLatest commit: 14411d1 We got this. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet 🙌
@@ -46,7 +46,8 @@ const createConfigItems = (babel, type, items) => { | |||
}); | |||
}; | |||
|
|||
const presetEnvRegex = RegExp(/@babel\/(preset-)?env/); | |||
const environmentPreset = '@babel/preset-env'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer finds @babel/env
, which is an alias of @babel/preset-env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I searched for it and couldn't find any usage of it. i'll create a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh - yeah we don't have a test for it, just it's possible to get that value when we read in user config.
@@ -141,6 +138,7 @@ export default () => { | |||
}, | |||
preset.options, | |||
{ | |||
bugfixes: customOptions.modern, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just always be set to true
, it has no effect on cases where the output is below the affected syntax level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet
🎉 thank you! |
Can this be released? Just ran into #522 and wasted some time... |
This PR removes the usage of
@babel/preset-modules
and use@babel/preset-env
with the bugfixes flag when bundling for modern browsers.This enables "Optional chaining" and "nullish coalescing" by default without a babelrc override.
Fixes #522
Fixes #694