Vite 7 Dep Optimizer Skips Dynamic Imports in Unreferenced Functions
- Investigating(current)
- Trending(upcoming)
- Workaround available(upcoming)
- Resolved(upcoming)
Executive summary
The Vite 7 dep optimizer fails to scan dynamic imports inside unreferenced functions, leading to missing dependencies and potential runtime issues. This affects single-file components where event handlers or actions are used only within the template.
No verified workaround yet
None of the linked reports describe a mitigation. Follow this incident to hear when one appears.
Under active investigation. No report has identified a root cause yet.
Evidence
1 report · 1 GitHubShow
- [1]GitHub First reportDep optimizer scan misses dynamic imports inside unreferenced functions (regression from Vite 7), e.g. Svelte/Vue handlers used only in the template(opens GitHub issue in a new tab)
Describe the bug Since the Rolldown-based dependency scanner, a dynamic import() inside a function that the scanned module never references is not crawled. Dependencies of the imported module are not pre-bundled at startup. Vite 7's esbuild scanner did crawl them. This matters for single-file components. The scanner sees only the <script> block, so a function used only in the template (an event handler, a Svelte action or {@attach}, a Vue @click) looks unreferenced. Its lazily imported…
by janosh 0upvotes 0comments
Timeline
- First report on GitHub issue
Dep optimizer scan misses dynamic imports inside unreferenced functions (regression from Vite 7), e.g. Svelte/Vue handlers used only in the template
Source