sveltejs/kit · warning
`$env/dynamic/public` is deprecated, use `$app/env/public` i
Error message
`$env/dynamic/public` is deprecated, use `$app/env/public` instead
What it means
The `$env/dynamic/public` module is deprecated in favor of `$app/env/public`. The module re-exports the same public dynamic environment object and prints this DEV warning when imported. Functionality is otherwise unchanged; only the import path should move.
Source
Thrown at packages/kit/src/runtime/env/dynamic/public.js:6
import { DEV } from 'esm-env';
import * as env from '../../app/env/public/index.js';
export { env };
if (DEV) {
console.warn('`$env/dynamic/public` is deprecated, use `$app/env/public` instead');
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Change imports to `import { env } from '$app/env/public'`
- Leave `env.VAR_NAME` accesses as-is
- Update re-export barrels or shared config modules referencing the old path
Example fix
// before
import { env } from '$env/dynamic/public';
// after
import { env } from '$app/env/public'; Defensive patterns
Strategy: validation
Validate before calling
import { env } from '$app/env/public'; // correct specifier
// CI grep: ! grep -r "\$env/dynamic/public" src/ Prevention
- Use $app/env/public for public env access
- Restrict legacy $env/* imports via lint rules
- Search codebase for old specifier when upgrading SvelteKit
When it happens
Trigger: Importing `import { env } from '$env/dynamic/public'` anywhere in client or shared code during development.
Common situations: Client components reading public env (e.g. API keys, feature flags) via the old specifier; codebases updated to a SvelteKit version that renamed env modules under `$app/env`.
Related errors
- `$env/dynamic/private` is deprecated, use `$app/env/private`
- `$env/static/private` is deprecated, use `$app/env/private`
- `$app/environment` is deprecated, use `$app/env` instead
- Cannot import `$app/*` modules other than `$app/env` inside
- Reading `config.kit` inside adapters is deprecated — it shou
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/9d98193682d3c9e3.
Report an issue: GitHub.