sveltejs/svelte-preprocess

Sourcemap not preserved when using external HTML/JS

Open

#382 opened on Jul 6, 2021

View on GitHub
 (1 comment) (2 reactions) (0 assignees)TypeScript (150 forks)auto 404
bughelp wanted

Repository metrics

Stars
 (1,798 stars)
PR merge metrics
 (PR metrics pending)

Description

Describe the bug

When using external HTML/JS files, it seems that sourcemaps are not preserved, even with all sourcemap options set to true (on svelte options, rollup options, and svelte-preprocess options).

Using a single .svelte file instead of external HTML/JS files seems to fix the issue.

To Reproduce

I wrote a minimal repro. To run it:

git clone https://gist.github.com/4a7b3e5cb94626a97352435de79fbfac.git repro
cd repro
npm i
npm start

Then go to localhost:8080 and open the Chrome DevTools.

Expected behavior

The DevTools should show the actual line of code with the debugger statement. Instead, it shows the .svelte file which just lists the external resources:

Screenshot from 2021-07-06 08-27-06

Information about your project:

Chrome 91, Ubuntu 20.04, svelte-preprocess 4.7.3, Rollup 2.52.7

Contributor guide