Skip to content

[Bug]: Incorrect source map sources when using SourceMapDevToolPlugin and CssExtractRspackPlugin #12020

@chenjiahan

Description

@chenjiahan

System Info

@rspack/core 1.6.0-beta.1

Details

The generated source maps contains invalid sources when using SourceMapDevToolPlugin and CssExtractRspackPlugin together.

  • Rspack config:
const config = {
  plugins: [
    new rspack.CssExtractRspackPlugin({}),
    new SourceMapDevToolPlugin({
      test: /\.css$/,
      filename: "[file].map",
      moduleFilenameTemplate: "[absolute-resource-path]",
    }),
  ],
};
  • Source map generated by Rspack (not a valid absolute path):
{
  "sources": [
    "/rspack-repro-css-source-map-absolute-path/./src/render.css"
  ],
  // ...
}
  • Source map generated by webpack:
{
  "sources": [
    "/rspack-repro-css-source-map-absolute-path/src/render.css"
  ],
  // ...
}

Reproduce link

https://github.com/chenjiahan/rspack-repro-css-source-map-absolute-path

Reproduce Steps

  1. pnpm i
  2. pnpm build:rspack
  3. pnpm build:webpack

Metadata

Metadata

Assignees

Labels

teamThe issue/pr is created by the member of Rspack.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions