Backtestsvuerun-20261001-022054#15126
compileScript drops template imports from returned when analysis re-runs on a transformed template AST
The harness couldn't finish this ticket.
harness-error at baseline. No judgment was produced for this ticket. It counts as an error in the run total.
Solve
—
Wall-clock time in the container
Full test suite
Not run
The harness did not reach the test stage
Contamination audit
Unknown
See the audit notes for this run
Patch size
0vs 0 merged
Changed lines, ours vs merged
The issue
View on GitHubVue version
3.5.40
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-evwepvbu?file=package.json
Steps to reproduce
Compile more than 500 unique SFCs for client + SSR (non-inline mode), share each file's descriptor between the two passes (the same way @vitejs/plugin-vue does). The client pass compileTemplate changes the shared template.ast in place, when the analysis cache (capped at 500) evicts a file entry, its SSR compileScript pass re-runs the import usage analysis on that already transformed AST
What is expected?
__returned__ contains every import the template references, same output as when fewer than 500 templates are compiled. The analysis should re-parse when the AST was already transformed, the same guard compileTemplate has with if (inAST?.transformed) in line 214.
What is actually happening?
Imports referenced only from template expressions or with v-for are dropped from __returned__. While the render function still emits $setup.foo(...) and throws TypeError: $setup.foo is not a function at runtime. Because it only happens with more than 500 unique templates it only comes up in large apps in development, in production builds the template are inlined and are unaffected.
System Info
Any additional comments?
Might be the cause for vitejs/vite-plugin-vue#764, vitest-dev/vitest#9855?
The two patches
No patch was produced.No patch was produced.