Skip to content

Svelte 5: Inaccurate source maps when lang="ts" is enabled #9961

@AdrianGonz97

Description

@AdrianGonz97

Describe the bug

Source maps are seemingly inaccurate when lang="ts" is enabled on the <script> tag. This only occurs when using TS in Svelte 5. Removing lang="ts" fixes the issue.

When presented with the following Svelte code:

img

Errors locations are accurate in the IDE (as shown above), but are off in both the terminal output, and the error page.

img

Reproduction

https://github.com/AdrianGonz97/svelte-5-ts-source-maps-reproduction

Logs

No response

System Info

  System:
    OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 7.95 GB / 31.30 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.volta/tools/image/node/20.10.0/bin/node
    Yarn: 1.22.21 - ~/.volta/tools/image/yarn/1.22.21/bin/yarn
    npm: 10.2.3 - ~/.volta/tools/image/node/20.10.0/bin/npm
    pnpm: 8.10.5 - ~/.volta/bin/pnpm
    bun: 1.0.2 - ~/.bun/bin/bun
  npmPackages:
    svelte: ^5.0.0-next.26 => 5.0.0-next.26

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions