SvelteKit generates the $env/*
files as TypeScript modules that don't exist as files. To make DX better, but how the .env
file is read is left to the platform, so there exist no env.(js|ts)
I could add to "paths"
in knip.json
(similar to https://knip.dev/features/compilers#svelte).
I haven't found the way to just ignore imports starting with $env
, and both Claude and ChatGPT hallucinated ignoreImports
, so I guess it's not possible.
It would be great to be able to tell knip trust me, this is ok.
(I want to use it in pre-commit hook, but because it exits with code 1 I can't commit anything π )
Reproduction:
npm run knip
Unresolved imports (1)
$env/static/public src/routes/+page.svelte:1:9
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too