Skip to content

declarationMap sources not following src filename #14765

@jnath

Description

@jnath

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"],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions