Skip to content

Conflict order of styles #382

@blackswanny

Description

@blackswanny

Good day, we moved from 2.6 webpack to 4.28.4. It's a big bump and of course we migrated from old css plugin to new mini-css-extract-plugin. However, it doesn't bundle css properly anymore, which causes wrong render
We have dozens of the next warnings. Seems like something is wrong with optimization of chunks of css

WARNING in chunk bootstrap [mini-css-extract-plugin]
Conflicting order between:
 * css ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/styles/components/1.scss
 * css ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/styles/components/2.scss
 * css ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/styles/components/3.scss
 * css ./node_modules/css-loader!./node_modules/sass-loader/lib/loader.js!./src/styles/components/4.scss

rule is

      {
        test: /\.s?css$/,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader',
          'sass-loader'
        ]
      }

optimization looks like

    optimization: {
      splitChunks: {
        name: 'bootstrap',
        minChunks: Infinity,
        cacheGroups: {
          bootstrap: {
            filename: '[name].[chunkhash].js'
          },
          styles: {
            name: 'styles',
            test: /\.css$/,
            chunks: 'all',
            enforce: true
          }
        }
      }
    },

plugins is

new MiniCssExtractPlugin({ filename: 'style.css' })

if I replace MiniCssExtractPlugin.loaderwith style-loader, it seems to be switched off and error no longer appears, except I have no static/style.css file generated and all styles become inlined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions