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(babel): set useBuiltins to false during MODERN_BUILD #1758
Conversation
So I've been thinking .... When set Right now, I don't see a problem with that because preset-env will only polyfill stuff that's currently standard, and all browsers that support But if at some point in the future one of those browsers would lag behind on a feature that becomes standard, the "modern" bundle would not receive that polyfill even though the browser might have been configured correctly in Am I thinking correctly here? If so - is there another way to implement this? Can we somehow reset the browser targets which are defined in package.json's |
Ok so I think I got it now. from preset-env docs:
This makes it sound as if Edit: Seems to be a bug indeed, or at least in discussion. Anyway, instead of setting So if in the future one of the browsers supporting esmodules may require a polyfill to run then-current standard JS, Seems much better to me. Thoughts @yyx990803 ? |
This is ready as far as I'm concerned. I think I weighted all the options. |
...instead of deactivating `useBuiltins`. Leaves possibility for future polyfills open.
I think this behavior is interesting for performance-minded people, who want to be sure that modern is really a "minimal" build. Therefor: will this be mentioned in the docs? |
We are always happy to accept PRs :) So please go ahead and make a suggestion what you want to be documented better: https://cli.vuejs.org/guide/browser-compatibility.html#modern-mode |
closes #1727
when building in modern mode, polyfills still get included by babel-preset-env even though we set
targets: { esmodules: true }
here and skip applying the default polyfills hereAppereantly babel-preset-env still respects the
browserslist
field from package.json whenuseBuiltIns
is'usage'
or'entry'
.This PR sets
useBuiltIns:
false` when a modern build is running.I'm think pondering wether this could have any side-effects?