feat(plugin-legacy): make terser optional if renderLegacyChunk false#9453
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.
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
terseris 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
legacyplayground only.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).