You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you try to access $env/dynamic/private during application startup (for example at top level of hooks) then env is empty ({}) ONLY when manualChunks configuration is set.
I'm not sure if this is something we can fix, arguably it's a misconfiguration. IIRC we have some specific logic to ensure env variables are available before the rest which involves code splitting, and this may undo that logic
@dummdidumm I don't really have any interest in fiddling with the server builds, but I would like to reduce the amount of built client side JS files using this approach.
Describe the bug
If you try to access $env/dynamic/private during application startup (for example at top level of hooks) then
env
is empty ({}
) ONLY whenmanualChunks
configuration is set.Reproduction
Repo:
https://github.com/khromov/env-var-manualchunks-repro
SvelteKit manualChunks bug explanation
Broken version:
FOO is undefined although we set it.
But when going to http://localhost:3000/ we get it:
Then, remove the
manualChunks
option fromvite.config.ts
and run again:Now FOO is set and works correctly both during init and on web.
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: