-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source maps include preprocessed source instead of original #171
Comments
I think the problem is that the source map from preprocessing is not passed into the compiler by |
Thanks! Yes, I missed Webpack in the original description. I've transferred this to the |
@rtpt-jonaslieb Can you test a fix and tell me if that worked out for you? yarn add -D svelte-loader@sveltejs/svelte-loader
# or
npm i -D sveltejs/svelte-loader |
@non25 Sorry, I just got around to thoroughly test the new feature. There is a regression however: Previously, the preprocessed
some time after the compilation, as far as I can tell from a minimal project. Anyways, the line mapping is really helpful, so thanks for the swift implementation. |
This sounds like ampproject/remapping#116 , which is used in Svelte core to merge the preprocessed source map and the resulting map. If the preprocessed source map is empty, it happens. |
Should we fix it in |
There is a draf PR for it upstream in Svelte core sveltejs/svelte#6089 . Does the current behavior cause problems or is it just a "I noticed this" thing? |
For my use case, this means that I always need to jump back to the editor to see the actual Svelte code. Ideally, I'd have all of that directly in the browser... |
Describe the bug
I am using Svelte, TypeScript and Webpack. As far as I understand the source map feature implemented in sveltejs/svelte#5584, Svelte should transform the source map generated by TypeScript (via svelte-preprocess) into the final source map. This is not the case, apparently the source map contains the preprocessed JavaScript output. For example, the following Svelte component:
results in the following content in the sourcemap:
Logs
The log line in the developer console reads
This is App.svelte, line 4! [...] App.svelte:2:8
.To Reproduce
Clone this repository: https://github.com/baileyherbert/svelte-webpack-starter
Update to the latest Svelte version (
npm update
) and run the servernpm run dev
. View the source content in the browser console.Expected behavior
I would expect the original TypeScript source to be contained in the source map. The line/col mappings should refer to the original locations in
App.svelte
.Information about your Svelte project:
Severity
Severity: Only annoying.
The text was updated successfully, but these errors were encountered: