sass / dart-sass

The reference implementation of Sass, written in Dart.
https://sass-lang.com/dart-sass
MIT License
3.97k stars 360 forks source link

sourcemap error while using 'modern-compiler' #2356

Closed joshyu closed 1 month ago

joshyu commented 1 month ago

I updated my project to use 'sass-embedded' and 'dart-sass' in my webpack configuration. I found from the documentation that we need to use modern compiler JS API, so my update is as below:

image

but I incorrectly generate the sourcemap, it can't map to the original SCSS file. the error message is: Could not load content for webpack://source-file.scss (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)

when I switch back to legacy JS API, the source map can map correctly.

Does anyone know why SASS modern-compiler API will lead to the sourcemap issue? how to fix it?

nex3 commented 1 month ago

It's up to the code that invokes the compiler—in this case the WebPack plugin—to correctly set up URLs for the source map. I recommend filing an issue against them, unless you can reproduce a case where the Sass API on its own produces incorrect output for the inputs it's given.