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

  1. Change the import specifier to `$app/env`: `import { browser, dev } from '$app/env'`
  2. Run a codemod/search-replace of `'$app/environment'` → `'$app/env'` across src
  3. 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

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


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/3609a6b766c4590c. Report an issue: GitHub.