Skip to content
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

Better preservation/fallback of/for source maps #377

Open
dummdidumm opened this issue Jun 23, 2021 · 5 comments
Open

Better preservation/fallback of/for source maps #377

dummdidumm opened this issue Jun 23, 2021 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dummdidumm
Copy link
Member

dummdidumm commented Jun 23, 2021

Is your feature request related to a problem? Please describe.
Some preprocessors might not return a source map. This breaks the "chain" of source maps and the result is that positions due to errors for example cannot be mapped correctly anymore.

Describe the solution you'd like
Investigate if there's a possibility to provide somewhat sane fallbacks for Style and Script preprocessors, like "return a source map that indicates that script/style now has this length instead of the previous one". Don't know how to phrase this better, just an idea.

How important is this feature to you?
Nice to have

@dominikg
Copy link
Member

this causes issues with vite, eg. https://github.com/sveltejs/kit/issues/1745 (I also saw it happen with windicss), so i'm in favor of providing sourcemaps where possible.

In case of postcss i'm sure that it does provide sourcemaps, so it should be possible to pass them on. The case where a preprocessor does not return a sourcemap should/could be handled in svelte core instead.

@dominikg
Copy link
Member

Addendum: I think svelte-preprocess itself is a bit of a special case due to it's internal handling of multiple preprocess steps with a single preprocessor (preprocess: sveltePreprocess()), so it might have to account for missing sourcemaps in its internal steps also

@benmccann
Copy link
Member

Some preprocessors like PostCSS do not return a source map

Are you sure about this? If so, we should fix that. I thought that it did though. I remember @milahu trying to fix some issues with the line numbers being a bit off in #286, so I'd expect it was returning something at some point. He also had started on some improvements in the postcss css repo postcss/postcss#1487, but they were not completed/merged

@dummdidumm
Copy link
Member Author

No honestly I'm not sure about it 😄 I adjusted the wording

@bluwy
Copy link
Member

bluwy commented Sep 4, 2021

FWIW @dominikg had implemented this for vite-plugin-svelte a while ago. It's under the experimental options though and I've never heard anyone using it. But if it works, the code could be re-used internally here or in Svelte core too.

@kaisermann kaisermann added enhancement New feature or request help wanted Extra attention is needed labels Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants