Sass loader not working in webpack

后端 未结 3 1008
一向
一向 2021-02-07 02:56

I am trying to get *.scss files to be supported in my webpack configuration but I keep getting the following error when I run the webpack build command:

ERROR in         


        
3条回答
  •  佛祖请我去吃肉
    2021-02-07 03:42

    The problem is solved by setting source-map option to true (as seen in other answers).

    But in case you find messy passing options in the query string there is an alternative;

    for configuring the sass loader you can create a sassLoader property in the webpack config object:

    module.exports = {
      devtool: 'eval',
      entry: [
        './app'
      ],
      output: {
        path: path.join(__dirname, 'dist'),
        filename: 'index.js',
        publicPath: '/dist/'
      },
      plugins: [
        new webpack.NoErrorsPlugin()
      ],
      resolve: {
        extensions: ['', '.js']
      },
      module: {
        loaders: [{
          test: /\.scss$/,
          loader: 'style!css!sass'
          // loader: ExtractPlugin.extract('style', 'css!sass'),
        }]
      },
      sassLoader: {
        sourceMap: true
      },
    }
    

提交回复
热议问题