Skip to content

Wrong SourceMap genrated #434

Closed
Closed
@zq1997

Description

@zq1997

Details

Wrong SourceMap genrated

Reproduction (Code)

// webpack.config.js
...
entry : {
  test: './src/test.css',
}
plugins: [
  new webpack.SourceMapDevToolPlugin({
    filename: '[file].map',
    noSources: true,
    moduleFilenameTemplate: '[resource-path]'
  }
],
module: {
  rules: [
    {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              sourceMap: true
            }
          },
          Conf.cases(Conf.prod, {
            loader: 'postcss-loader',
            options: {
              plugins: [
                autoprefixer,
                cssnano
              ],
              sourceMap: true
            }
          })
        ]
    }
  ]
}
...
body {
    margin: 0;
}

generated sourcemap has wrong path test.css instead of ./src/test.css

{"version":3,"sources":["test.css"],"names":[],"mappings":"AAAA,KACI,QACJ,C","file":"test.css","sourceRoot":""}

Environment

OS node npm/yarn package
Ubuntu20.04.1 LTS 13.14.0 6.14.4 3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions