You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been unable to get tree shaking to work in my application. When used with default setting, the bundle size is equivalent to having rollupOptions.treeshake set to false, indicating that it's not applying correctly.
Setting rollupOptions.treeshake to "smallest" causes all program code to be removed from the emitted bundle. The content of index.js boils down to the following:
In the linked repository, the result of a build with "smallest" is the following. Note how it does not contain my code, only boilerplate:
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I have been unable to get tree shaking to work in my application. When used with default setting, the bundle size is equivalent to having
rollupOptions.treeshake
set tofalse
, indicating that it's not applying correctly.Setting
rollupOptions.treeshake
to"smallest"
causes all program code to be removed from the emitted bundle. The content ofindex.js
boils down to the following:In the linked repository, the result of a build with
"smallest"
is the following. Note how it does not contain my code, only boilerplate:I am unsure how to get tree shaking to work, and the documentation I've been able to find so far has not taken me very far.
Reproduction
https://github.com/gabrielecirulli/vite-treeshaking
Steps to reproduce
vite.config.js
to see whetherrollupOptions.treeshake
is set to"smallest"
or not.vite build
with the above configuration.index
file.index
file and observe the code.System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: