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
fix: eagerly initialise dynamic env vars from process.env at module-eval time
Previously, `$app/env/private` and `$app/env/public` dynamic variable values were only
populated when `Server.init()` called `set_env()`. If any module reading these
values was evaluated before `Server.init()` ran (e.g. via bundler chunk
colocation with `instrumentation.server.js`), the values would be silently
`undefined`.
The `__sveltekit/env` module now calls `set_env(process.env)` at module-eval
time, ensuring values are populated and validated before any module that
imports `$app/env/*` is evaluated. On platforms without `process.env`
(Cloudflare Workers, Vercel Edge), the guard skips initialization and
`Server.init()` populates env as before. If required env vars are missing from
`process.env`, `set_env` will throw — this is intentional, as the app cannot
function without them.
This also replaces the dev-only auto-init that was added in #16223, extending
the same safety to production builds.
0 commit comments