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

@vitejs/plugin-legacy modernPolyfill is not affected by target/browserslist/source code #8399

Closed
7 tasks done
kingyue737 opened this issue May 30, 2022 · 4 comments · Fixed by #8408
Closed
7 tasks done
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) plugin: legacy

Comments

@kingyue737
Copy link
Contributor

Describe the bug

I'm using plugin-legacy to add polyfill for modern browsers. However, the polyfills used are always the same no matter what target or browserslist I set.

Then I add structuredClone method in main.js. Unfortunately, web.structured-clone is not added by plugin. It seems that what method I use in source code does not affect modernPolyfills, either.

I tried both 1.8.2 and 2.0.0-alpha.1

Reproduction

https://stackblitz.com/edit/vitejs-vite-gsrtkm

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 4.26 GB / 15.70 GB
  Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (101.0.1210.47)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @vitejs/plugin-legacy: ^1.8.2 => 1.8.2
    vite: ^2.9.9 => 2.9.9

Used Package Manager

npm

Logs

vite v2.9.9 building for production...
✓ 4 modules transformed.
rendering chunks (1)...[@vitejs/plugin-legacy] modern polyfills: Set(4) {
  'core-js/modules/es.array.iterator.js',
  'core-js/modules/web.dom-collections.iterator.js',
  'core-js/modules/es.promise.js',
  'core-js/modules/es.regexp.exec.js'
}
dist/assets/favicon.17e50649.svg           1.49 KiB
dist/index.html                            0.53 KiB
dist/assets/index.e9192aae.js              0.91 KiB / gzip: 0.53 KiB
dist/assets/index.06d14ce2.css             0.17 KiB / gzip: 0.14 KiB
dist/assets/polyfills-modern.e9f39d78.js   34.19 KiB / gzip: 14.12 KiB

Validations

@sapphi-red sapphi-red added plugin: legacy p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels May 31, 2022
@sapphi-red
Copy link
Member

sapphi-red commented May 31, 2022

About browserslist, it is tracked at #2476.
modernPolyfills not including structuredClone polyfill is a bug.

@kingyue737
Copy link
Contributor Author

@sapphi-red Not only browserslist, even explicitly changing targets in plugin-legacy config does not affect polyfills-modern included

@sapphi-red
Copy link
Member

@kingyue737
Copy link
Contributor Author

Ah I see. Currently, modernpolyfills always targets to all browsers supporting ESM, no matter what targets are set. Thank you!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) plugin: legacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants