declarationMap sources not following src filename
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
When using SvelteKit with TypeScript declaration maps enabled, the generated .d.ts files for .svelte components correctly include a .d.ts.map file.
However, IDEs like VSCode do not follow the .d.ts.map back to the original .svelte source, even though the map exists and points to the right file.
This breaks TypeScript navigation (“Go to definition”) and makes debugging or inspection of Svelte component types harder.
Reproduction
Open this minimal reproduction:
👉 StackBlitz – SvelteKit declarationMap issue reproduction
Build the Svelte component to generate .d.ts and .d.ts.map.
In an editor (e.g. VSCode), Ctrl/Cmd + click on the imported component.
Logs
System Info
System:
OS: Linux 6.8 Ubuntu 24.04.3 LTS 24.04.3 LTS (Noble Numbat)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Memory: 11.41 GB / 31.07 GB
Shell: 5.9
Binaries:
Node: 22.14.0
npm: 10.9.2
pnpm: 10.14.0
Browsers:
Chrome: 141.0.7390.65
Severity
annoyance
Additional Information
Actual
{"version":3,"file":"Toto.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Toto.svelte.ts"],
Expected
{"version":3,"file":"Toto.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Toto.svelte"],
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked StackBlitz reproduction and build the component to inspect dist/Toto.svelte.d.ts.map. Compare its sources entry with the reported actual and expected paths, including src/lib/Toto.svelte.ts and src/lib/Toto.svelte; done means editors can follow the declaration map to the .svelte source.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100