Skip to content

sources field of map does not contain path. #490

Closed
@WearyMonkey

Description

@WearyMonkey
  • Operating System:
    OSX 10.14.6 (18G95)

  • Node Version:
    v10.16.0

  • NPM Version:
    yarn 1.21.1

  • webpack Version:
    4.41.5

  • css-loader Version:
    3.4.1

Expected Behavior

Sources field of the sourcemap contains the path relative to the context. e.g. "sources":["src/foo/index.css"]

Actual Behavior

Sources field of the sourcemap contains just the file name. e.g. "sources":["index.css"]

Code

// webpack.config.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');

module.exports = {
  entry: './src/foo/index.css',
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader?sourceMap',
        ]
      }
    ]
  },
  plugins: [new MiniCssExtractPlugin()],
};

How Do We Reproduce?

  1. Create a webpack project with the above configuration.
  2. yarn webpack
  3. cat dist/main.css.map

Note, the sources field is "sources":["webpack:///index.css"]

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