dart-sass icon indicating copy to clipboard operation
dart-sass copied to clipboard

Source mappings wrong when using compressed style

Open david10sing opened this issue 2 years ago • 9 comments

Context

I am experiencing an issue when using the JS API, sourcemap compile option when used in tandem with style = compressed.

The source map is produced and I write it to a file. However, the mappings are broken and in Chrome's devtools, I am seeing styles pointing to the wrong file.

Screenshots

Wrong

image

Correct

image

Question

  • Is this something that's known or it is not behaving correctly and might be due to the repository's setup and the scss files?

david10sing avatar Feb 26 '23 21:02 david10sing

Can you provide a minimal repo that reproduces this issue?

nex3 avatar Feb 28 '23 21:02 nex3

Hi @nex3

Here is a link to a reproduction repo

https://github.com/david10sing/minified-sass-breaking-sourcemap

david10sing avatar Mar 01 '23 03:03 david10sing

That repro looks like it passes the Sass output, including the sourcemap, through PostCSS. Can you reproduce it with Sass alone?

nex3 avatar Mar 02 '23 23:03 nex3

Hi @nex3

Removed the postcss processing.

As you will see, it has the same issue. I also renamed the class names so it's clearer. .index should come from index.scss but is instead pointing to _test.scss

david10sing avatar Mar 06 '23 04:03 david10sing

I can't reproduce that. Here's what I did:

$ git clone https://github.com/david10sing/minified-sass-breaking-sourcemap
$ cd minified-sass-breaking-sourcemap
$ npm i
$ mkdir dist
$ node sass-compiler.js

I then opened https://sokra.github.io/source-map-visualization/ and uploaded the generated index.css and index.css.map files. The .index class is clearly mapped to the correct location in index.scss.

nex3 avatar Mar 06 '23 21:03 nex3

@nex3

It's not in chrome devtools inspector

david10sing avatar Mar 07 '23 00:03 david10sing

That sounds like a bug in the chrome devtools inspector. Have you tried reporting it there?

nex3 avatar Mar 07 '23 00:03 nex3

Thank you @nex3

Reported ☝️

david10sing avatar Mar 09 '23 20:03 david10sing

@david10sing That is not the right place for chrome bugs, please follow instructions on this page: https://www.chromium.org/for-testers/bug-reporting-guidelines/

ntkme avatar Mar 09 '23 23:03 ntkme