-
-
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
feat(plugin-legacy): make terser optional if renderLegacyChunk false #9453
Conversation
if (format === 'iife') { | ||
minify = minify ? 'terser' : false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This function is only called in two places. One for building the modern polyfilll chunk, two for legacy polyfill chunk. They pass es
and iife
respectively. So this changes that modern polyfills uses esbuild instead, which should be fine.
I'm not sure about this. Most users would be using plugin-legacy for legacy chunks and those users will need to install terser by themselves. Also we don't recommend users to include polyfill automatically for modern chunks. |
I think plugin-legacy is also viable for generating modern-polyfills only as there's no other official/simple way to do so.
I think that only applies for |
If someone is only using |
Interesting, I guess doing it that way is an option too, but I think it's more laborious for those who want to quickly set it up or not familiar with the tools, and harder to achieve this trick too. A plugin would simplify all the steps. 🤔 |
If we want to provide this feature, I think providing it with a different plugin is better.
|
Closing as terser is also now required for polyfills chunk minifying since #9635 |
Description
terser
is only needed if we're rendering legacy chunks. IfrenderLegacyChunks: false
, we don't need terser as the existing code also actually doesn't need it, pervite/packages/plugin-legacy/src/index.ts
Lines 349 to 360 in 5f50693
where
const genLegacy = options.renderLegacyChunks !== false
.Ref #9435 (comment)
Additional context
So far tested manually with the
legacy
playground only.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).