Skip to content

Debugging source maps issue and possible fix #180

Closed
@madisc

Description

@madisc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions