Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sources field of map does not contain path. #490

Closed
WearyMonkey opened this issue Jan 7, 2020 · 2 comments
Closed

sources field of map does not contain path. #490

WearyMonkey opened this issue Jan 7, 2020 · 2 comments

Comments

@WearyMonkey
Copy link

  • 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"]

@alexander-akait alexander-akait transferred this issue from webpack-contrib/css-loader Jan 9, 2020
@alexander-akait
Copy link
Member

Bug on css-loader side webpack-contrib/css-loader#622 because postcss generate relative source maps, not absolute, so we can't contexity them in the right now, anyway it is fixed in postcss@8 (I help release will be near future - next week) and we will fix it, close in favor webpack-contrib/css-loader#622

@alexander-akait
Copy link
Member

Just note - postcss-loader has the same bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants