
Description
Describe the bug
I am using Svelte, TypeScript and Webpack. As far as I understand the source map feature implemented in sveltejs/svelte#5584, Svelte should transform the source map generated by TypeScript (via svelte-preprocess) into the final source map. This is not the case, apparently the source map contains the preprocessed JavaScript output. For example, the following Svelte component:
<script lang="ts">
let name: string = 'world';
console.log("This is App.svelte, line 4!");
</script>
<main>
Hello {name}!
</main>
results in the following content in the sourcemap:
<script lang="ts">let name = 'world';
console.log("This is App.svelte, line 4!");
</script>
<main>
Hello {name}!
</main>
Logs
The log line in the developer console reads This is App.svelte, line 4! [...] App.svelte:2:8
.
To Reproduce
Clone this repository: https://github.com/baileyherbert/svelte-webpack-starter
Update to the latest Svelte version (npm update
) and run the server npm run dev
. View the source content in the browser console.
Expected behavior
I would expect the original TypeScript source to be contained in the source map. The line/col mappings should refer to the original locations in App.svelte
.
Information about your Svelte project:
- Firefox 78.8.0esr
- Debian Linux 10
- Svelte version 3.35.0
- svelte-preprocess 4.6.9
- svelte-loader 3.0.0
- TypeScript 4.2.3
- Webpack 5.26.2
Severity
Severity: Only annoying.