Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead

前端 未结 4 1422
清酒与你
清酒与你 2021-01-30 19:20

I see the following errors when trying to start my app...

> css-modules@1.0.0 start /Users/johnnynolan/Repos/css-modules

webp

4条回答
  •  面向向阳花
    2021-01-30 19:50

    Yea, I got the same issue with webpack 4.10.2. The problem is fixed after I swap the extract-css-chunks-webpack-plugin to mini-css-extract-plugin.

    Here's the webpack config changes:

    -const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
    +const MiniCssExtractPlugin = require("mini-css-extract-plugin");
    
    module.exports = {
      name: 'client',
      target: 'web',
      module: {
        rules: [
          {
            test: /\.css$/,
    -       use: ExtractCssChunks.extract({
    -         use: 'css-loader'
    -       })
    +       use: [
    +         {
    +           loader: MiniCssExtractPlugin.loader,
    +         },
    +         "css-loader"
    +       ]
          }
        ]
      },
    // 
    // other config........
    //
       plugins: [
    -    new ExtractCssChunks(),
    +    new MiniCssExtractPlugin({
    +        filename: `components/[name].css`
    +    }),
         //
         // other config........
         //
       ]
    
    

    Hope it can help.

提交回复
热议问题