-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Built JS code not fully minified when dynamic import is used #15300
Comments
At the moment, this is intentional. The |
On the other hand, at the moment there still seems to be room for optimization. For example, |
I think circling back on this, I'm definitely open to minifying the injected util code a bit so it's shorter (though complete minification is still not the goal). Fixing the empty array case would be nice as you mentioned. About the |
With this, there is another issue: I use the plugin @rollup/plugin-babel for transpiling to legacy browsers using the getBabelOutputPlugin mode. The code that Vite adds (__vite__mapDeps) is the only thing that doesn't get transpiled by this plugin because the addition occurs after the execution of the output plugins in Rollup. |
Describe the bug
Generated JS files that use dynamic imports are not fully minified. For example, when building the reproduction repository, a file
dist/assets/index-q-SMFOy6.js
is generated that contains some minified code, followed by the following code that is not minified:I would have expected that everything in this file is minified, including the
__vite__mapDeps
function.Reproduction
https://github.com/mdickopp/vite-minification-issue
Steps to reproduce
npm install
npm run build
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: