-
-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Describe the bug
Parsing of source maps fails, this shows up in VSCode as a warning - Unexpected token o in JSON at position 1svelte -
on the first line of Svelte typescript files.
To Reproduce
Setup a project with Svelte and Typescript; open project in VS Code.
Expected behavior
There should be no error.
Screenshots
System (please complete the following information):
- OS: Windows
- IDE: VSCode
- Plugin/Package: svelte-language-server
** Observations **
The issue is in this line of code:
| await new SourceMapConsumer(processedSingle.map.toString()), |
It uses .toString() to pass the value into the constructor of SourceMapConsumer. This is not needed, and it actually breaks the case where the source map is passed as an object - since the map becomes the string value '[object Object]'.
The source map should be passed as is, since SourceMapConsumer is able to handle both cases - see the _factory method here:
I propose to drop the .toString() - should I create a PR?
