-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Legacy plugin modern polyfills don't respect targets #14527
Comments
Indeed, when I modify this line to instead pass the targets instead of this hard-coded target, things work as expected vite/packages/plugin-legacy/src/index.ts Line 387 in 21ae371
|
@C-Higgins I've litterally done the same by patching this logic with Can concur that if targets is passed along side |
|
I think using the passed targets must be more correct than current behavior, no? Especially if |
@C-Higgins are you aware if this was this introduced in a specific release? |
@bluwy this package may be useful: https://github.com/nihalgonsalves/esbuild-plugin-browserslist |
@C-Higgins Making @jroru We need the other way round, esbuild target -> browserslist. The esbuild plugin does the opposite. |
Affected by this as well. Also, cross-linking this comment from #6922 talking about the same problem. |
@bluwy Could you elaborate why this is the case? As far as I understand, |
@jgosmann If we introduce a new |
Describe the bug
It seems that with
modernPolyfills: true
, neither thetargets
nor the browserlist config is used at all. Along with polyfilling more than necessary for a given target, I am unable to get it to change the polyfill at all regardless of any targets, however new or old.The docs say, "Note it is not recommended to use the true value (which uses auto-detection) because core-js@3 is very aggressive in polyfill inclusions due to all the bleeding edge features it supports." I understand that core-js may be aggressive, but I find it hard to believe that it thinks Chrome latest requires a polyfill for every possible feature used. In the reproduction link, notice the target is
last 1 chrome version
. Running the build lists a polyfill for Object.fromEntries, and includes it in the generated polyfill file, as well as something as old as Promise. The core-js compat file lists this as compatible in Chrome.Reproduction
https://stackblitz.com/edit/vitejs-vite-sdqghd?file=counter.js
Steps to reproduce
DEBUG="vite:legacy" npm run build
in linked stackblitzSystem Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: