Search code examples
csswebpackwebpack-style-loadercss-loader

Webpack / Style Loader / CSS module: CSS Object and JS Code doesn't match


I try to configure webpack to give me the same result from another building tool. It's a react app with webpack 1.15. The problem i'm facing is probably in the css/style loader (SCSS).

My css-loader is like this:

    loaders: [
  {
    test: /\.(scss|css)$/,
    // loader: 'style-loader!css-loader!sass-loader'
    loader: 'style!css?modules!sass'
  },

The result on the webpage is:

Chrome devtools screenshot showing object

The clasnames should be under a default property. That would fix this or i could remove default. But anyway i don't know how to do one if these.

'bz-webpart' is in main_modules_scss_1 (without default). Can anyone help?


Solution

  • I fixed this problem by replacing style loader with a custom style loader that replace('module.exports', 'module.exports.default'). Object.default is there. Everyone is happy!