sveltejs/kit · warning
`$app/environment` is deprecated, use `$app/env` instead
Error message
`$app/environment` is deprecated, use `$app/env` instead
What it means
Importing the module `$app/environment` (packages/kit/src/runtime/app/environment/index.js) re-exports `$app/env` for backwards compatibility and warns once in dev that the old path is deprecated. All exports are identical; only the import path changed.
Source
Thrown at packages/kit/src/runtime/app/environment/index.js:5
import { DEV } from 'esm-env';
export * from '../env/index.js';
if (DEV) {
console.warn('`$app/environment` is deprecated, use `$app/env` instead');
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Change the import specifier to `$app/env`: `import { browser, dev } from '$app/env'`
- Run a codemod/search-replace of `'$app/environment'` → `'$app/env'` across src
- Update any local typings/aliases that still reference `$app/environment`
Example fix
// before
import { browser } from '$app/environment';
// after
import { browser } from '$app/env'; Defensive patterns
Strategy: validation
Validate before calling
// fail CI if deprecated import path is used // grep -rn "\$app/environment" src && exit 1
Prevention
- Import from `$app/env` in all new code
- Add a lint/no-restricted-imports rule for '$app/environment'
- Update internal shared packages that re-export from the old path
When it happens
Trigger: Any `import { browser, dev, prerendering, building, version } from '$app/environment'` in app code during dev.
Common situations: Older SvelteKit projects or AI/tutorial snippets predating the `$app/env` rename; dependencies importing the old path.
Related errors
- `$env/dynamic/private` is deprecated, use `$app/env/private`
- `$env/dynamic/public` is deprecated, use `$app/env/public` i
- `$env/static/private` is deprecated, use `$app/env/private`
- 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/3609a6b766c4590c.
Report an issue: GitHub.