[Breaking Change] Put plugin-legacy
logic inside Vite core, for simplicity & flexibility and avoiding future breaking changes
#10858
Labels
Description
If I understand correctly, since Vite must use
terser
for minification of legacy chunks (and not theesbuild
one that do some issues), and Vite didn't want to introduce theterser
dependency by default, we have thatplugin-legacy
is not embedded in Vite core.But this is problematic, since the
plugin-legacy
isn't fully orthogonal from Vite core plugins (meaning that some plugins depends onplugin-legacy
behavior), we may benefit from embedding this plugin as a core plugin, so we can modify its internal behaviour without the worry of breaking changes, without worrying to not be compatible with someplugin-legacy
versions.Suggested solution
To embed the
plugin-legacy
logic in Vite core, without introducing theterser
dependency, I suggest to put all the logic ofplugin-legacy
inside an internal Vite core plugin, say:And then, the
plugin-legacy
will be a "dummy" package, containing the dependency to theterser
package, together with the following typescript file:This way, we introduce the ability to have flexible changes in the logic of
plugin-legacy
, while keeping the user experience similar to what happens today.I suggest this breaking change now, since Vite is working on the breaking version 4.0.
Alternative
No response
Additional context
As a proof of concept, this will make implementing #10383 very easy, while currently it feels you need to juggle with magic token strings and be extra careful to implement it right and safely!
Validations
The text was updated successfully, but these errors were encountered: