Open mnmkay opened 8 months ago
This started happening to me after a node_modules reinstall this week. It seems like maybe some sveltejs files aren't being whitelisted anymore. My workaround was to update server.fs.allow in vite.config.ts
:
allow = [..., '<path to node_modules>/@sveltejs/kit/src/runtime']
Edit: My build environment is git bash on Windows.
Describe the bug
I've run into this when attempting to run SvelteKit's introductory "SvelteKit demo app" from a folder that is junction'd (symlinked) on Windows. After a failing application (described in Steps to Reproduce below), I took a look around the vite code and was able to get it working. Whether or not the best resolution, this seems most closely related to vitejs/vite, nonetheless.
For my specific situation, these two locations require preserveSyminks to be set to true (as it is currently, the code is hardcoded to fail): https://github.com/vitejs/vite/blob/72104f6de5398a1a0511404e8485b3b7721be537/packages/vite/src/node/config.ts#L1100 https://github.com/vitejs/vite/blob/72104f6de5398a1a0511404e8485b3b7721be537/packages/vite/src/node/config.ts#L1063
Line 1100 goes to the externalize-deps plugin (via tryNodeResolve) and At line 1063, above it needs to be among the options, which get fed into esbuild (flagsForBuildOptions):
https://github.com/evanw/esbuild/blob/9d1777f23d9b64c186345223d92f319e59388d8b/lib/shared/common.ts#L225
(Incidentally and importantly, for eventual configuration/fix purposes: it seems these code locations are hit before either svelte.config.js or vite.config.ts are ever read)
Seems like this would not affect only Windows, but I don't know: Some other issues that might be related: (no idea). #16176 #10802
Reproduction
https://kit.svelte.dev/
Steps to reproduce
System Info
Used Package Manager
npm
Logs
No response
Validations