Svelte

Debugging source maps issue and possible fix

#180

Development PR

Issue

Solved
M
madisc
May 3, 2021, 2:40 AM

I'm using vscode to debug, and previously used rollup which worked. When I changed to webpack the svelte breakpoints weren't hit when using Svelte Preprocess (without was fine). I found adding this line makes it work:

if (!js.map.sourcesContent) {
    js.map.sourcesContent = [source];
  + js.map.sources = [compileOptions.filename] // ADD THIS
};

This may be a hacky solution, and I haven't tested it thoroughly, but Svelte breakpoints are now being hit. Hope this helps if anyone has been having similar issues.

Libs:

svelte 3.37.0 svelte-preprocess 4.7.2 svelte-loader 3.1.1 webpack 5.36.1

Info

Closed at May 22, 2021, 4:39 PM
Assignees None
Labels None
Milestone None

Pro tip: You can prefix GitHub URLs of issues, PRs or discussions with svcl.dev/ to view them on this page! Also try it on a GitHub release ;)