{"record":{"id":"c75ec6fe542f426e","repo":"sveltejs/kit","slug":"env-static-public-is-deprecated-use-app-env","errorCode":null,"errorMessage":"`$env/static/public` is deprecated, use `$app/env/public` instead","messagePattern":"`\\$env/static/public` is deprecated, use `\\$app/env/public` instead","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/env/static/public.js","lineNumber":5,"sourceCode":"import { DEV } from 'esm-env';\nexport * from '../../app/env/public/index.js';\n\nif (DEV) {\n\tconsole.warn('`$env/static/public` is deprecated, use `$app/env/public` instead');\n}\n","sourceCodeStart":1,"sourceCodeEnd":7,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/env/static/public.js#L1-L7","documentation":"In development mode, importing from the deprecated `$env/static/public` module triggers a console warning. SvelteKit renamed/relocated the environment variable modules and keeps `$env/static/public` as a re-export shim of `$app/env/public` for backwards compatibility. The warning tells you to update imports before the alias is removed in a future major release.","triggerScenarios":"Any dev-mode import of `$env/static/public` (e.g. `import { PUBLIC_API_URL } from '$env/static/public'`) executed in a module that is loaded while DEV is true; the shim re-exports and then warns.","commonSituations":"Upgrading an older SvelteKit project whose code or dependencies still reference the legacy `$env/static/*` paths; copy-pasted tutorials predating the module reorganization.","solutions":["Replace the import with `import ... from '$app/env/public'` in the offending file(s).","Search the repo for `$env/static/public` and update all occurrences (including in libraries you control).","Pin/update dependencies that internally import `$env/static/public` to versions using the new module path."],"exampleFix":"// before\nimport { PUBLIC_API_URL } from '$env/static/public';\n// after\nimport { PUBLIC_API_URL } from '$app/env/public';","handlingStrategy":"validation","validationCode":"// grep-style preflight check (e.g. in a lint script)\nconst offenders = await glob('src/**/*.{js,ts,svelte}')\n  .filter((f) => read(f).includes('$env/static/public'));\nif (offenders.length) throw new Error('Update to $app/env/public: ' + offenders.join(', '));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the new `$app/env/public` module path in all new code.","Add a lint rule or grep CI step banning `$env/static/public`.","Check dependency changelogs when upgrading SvelteKit for renamed module paths."],"tags":["deprecation","environment-variables","sveltekit"],"backgroundTag":"deprecated-module-import","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}