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
When one imports an asset (let's say .svg) using import.meta.glob(..., { eager: true, import: 'default' }) new path will be inlined in a const and then this const get's tree-shaked/optimized, corresponding asset is not excluded from the final build.
It's expected that no unused assets, especially heavy ones like fonts and images, are not included in final build.
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
When one imports an asset (let's say .svg) using
import.meta.glob(..., { eager: true, import: 'default' })
new path will be inlined in aconst
and then this const get's tree-shaked/optimized, corresponding asset is not excluded from the final build.It's expected that no unused assets, especially heavy ones like fonts and images, are not included in final build.
Reproduction
https://github.com/BerkliumBirb/vite-broken-tree-shaking
Steps to reproduce
npm i
npm run build
dist/
Expected to only have "dist/blue-XXX.svg", but "dist/red-XXX.svg" is also there yet not reachable from code.
System Info
npmPackages: vite: ^6 => 6.3.3
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: