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

plugin-legacy: allow excluding polyfills #19074

Open
4 tasks done
jxn-30 opened this issue Dec 25, 2024 · 0 comments · May be fixed by #19082
Open
4 tasks done

plugin-legacy: allow excluding polyfills #19074

jxn-30 opened this issue Dec 25, 2024 · 0 comments · May be fixed by #19082

Comments

@jxn-30
Copy link

jxn-30 commented Dec 25, 2024

Description

When using @vitejs/plugin-legacy, I can use the auto-detection feature to automatically include the polyfills needed, based on my codebase and my browserslist config.
However, there may be polyfills that I don't want to have included e.g. because I want to use a different polyfill implementation or another dependency / import already provides a polyfill. I don't want to manually specify all the other polyfills but rather have the option to exclude one or more specific polyfills.

As far as I have seen, including such a feature would not be difficult to implement, thus I intend to provide a PR with a try in the near future.

Suggested solution

Two new options excludeLegacyPolyfills and excludeModernPolyfills, both of type string[].
Before creating the chunks, designated polyfills are filtered to remove the polyfills passed in options.

Alternatively, a single option excludePolyfills could also do the job but in my eyes, it is reasonable to stick to the seperated configuration between legacy and modern.

Alternative

No response

Additional context

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant