Skip to content
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

Merged
merged 1 commit into from
Aug 28, 2020

Conversation

wardpeet
Copy link
Collaborator

@wardpeet wardpeet commented Aug 16, 2020

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

@changeset-bot
Copy link

changeset-bot bot commented Aug 16, 2020

🦋 Changeset is good to go

Latest 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

Copy link
Collaborator

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Sweet 🙌

@wardpeet wardpeet merged commit d08f977 into developit:master Aug 28, 2020
@wardpeet wardpeet deleted the fix/nullish-coalescing branch August 28, 2020 15:11
@github-actions github-actions bot mentioned this pull request Aug 28, 2020
@@ -46,7 +46,8 @@ const createConfigItems = (babel, type, items) => {
});
};

const presetEnvRegex = RegExp(/@babel\/(preset-)?env/);
const environmentPreset = '@babel/preset-env';
Copy link
Owner

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

Copy link
Collaborator Author

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

Copy link
Owner

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,
Copy link
Owner

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sweet

@jdpigeon
Copy link

🎉 thank you!

@quantizor
Copy link

Can this be released? Just ran into #522 and wasted some time...

@preact-bot preact-bot mentioned this pull request Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants