Sass loader not working in webpack

后端 未结 3 1002
一向
一向 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:34

    I have managed to get another workaround working that doesn't involve editing the css-loader libraries within my npm_modules directory (as per the answer by @chriserik).

    If you add '?sourceMap' to the sass loader the css loader seems to handle the output.

    Here is my updated configuration:

    var path = require('path')
    var webpack = require('webpack')
    
    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?sourceMap'
        }]
      }
    }
    

    P.S. I even expanded this test to include a compass-mixins include, and this worked too.

提交回复
热议问题