Sourcemaps with webpack css-loader

后端 未结 2 934
灰色年华
灰色年华 2021-02-01 05:16

I am struggling to get sourcemaps working with css-loader.

Output in console:

What the documentation from css-loader says:

Sourc

2条回答
  •  清酒与你
    2021-02-01 06:13

    There are some properties you need to set in your webpack config.

    {
       output: {
          ...
       },
    
       debug: true, // switches loaders into debug mode
       devtool: 'eval-cheap-module-source-map', // or one of the other flavors, not entirely sure if this is required for css source maps
       ...
    }
    

    The webpack dev server doesn't have debug on by default. Instead of setting it in your config, you can also pass the -d or --debug flag to webpack-dev-server via the CLI.

提交回复
热议问题