In our project we should add license headers to source files, but when I did that in our first .svelte file, I experienced the generated sourcemap is incorrect and it ignores the comments.
It makes the debugging more difficult and the test coverage result is useless as well.
Svelte version: 3.14.0
Example .svelte source:
<!-- Some comment
and more
and more details -->
<script>
const test = () => {
console.log('test');
}
</script>
When I want to debug test variable it points to the 2. line of the .svelte file.
This tool can help to visualize source map: http://evanw.github.io/source-map-visualization/
If I add the comment into the script tag, it works without any problem, but it looks stupid.
Seems like anu svelte file where the script tag is not on the first line the sourcemap is off.
Like when adding a second script tag with context="module" the second script tag in the file is off by the amount of lines before that script tag.
Confirmed. Anything (even a blank line) goes before the script tag will cause the sourcemap line number to be incorrect.
I have this issue if I put a
Most helpful comment
This should be fixed now in 3.22.0.