Skip to content

[Bug]: SCSS/SASS Source Maps do not resolve @import directives #4451

Open
@dretsa

Description

@dretsa

Version

System:
    OS: macOS 15.1
    CPU: (14) arm64 Apple M4 Pro
    Memory: 8.73 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 132.0.6834.111
    Edge: 132.0.2957.127
    Safari: 18.1

Details

When source maps are enabled for SCSS and you @import directive is used, the source is always index.scss instead of the imported file.
I am using the defaults for the most part, the only change is output.sourceMap.css: true. I have also tried setting all sassLoaderOptions.sassOptions.sourceMap*: true - no effect. It seems like source maps for CSS -> SCSS and CSS extraction are working but the SCSS source maps are not properly output.

I am using bootstrap - I can provide a quick repo with reproduction.

Image

Reproduce link

https://github.com/dretsa/rsbuild-scss-sourcemap-bug

Reproduce Steps

  1. Pull repo
  2. Run npm ci
  3. Run npm run dev
  4. Inspect the alert element in your browser

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions