Vue 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?
Vue 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 withif (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?