import scan merges script contexts causing duplicate variables and esbuild failure #5446
Closed
7 tasks done
Labels
p2-edge-case
Bug, but has workaround or limited in scope (priority)
Describe the bug
Vite merges scripts together from
.svelte
files that the Svelte compiler treats as separate scripts:vite/packages/vite/src/node/optimizer/scan.ts
Line 247 in 79c2a49
Reproduction
Add to
src/routes/index.svelte
:And then run
npm run dev
ornpm run build
System Info
Used Package Manager
npm
Logs
html:src/routes/index.svelte:59:12: error: "top" has already been declared
Validations
The text was updated successfully, but these errors were encountered: