1

I use webpack4, Extracting css using extract-text-webpack-plugin.

// ...
plugins: [
    ...htmls,
    new ExtractTextPlugin('style/[name].[contenthash].css')
]

// index.css
// home.css
// about.css

It's all okay, Correct output.

Until I use optimization.splitChunks to extract the react and react-dom frameworks.

optimization: {
    splitChunks: {
        cacheGroups: {
            commons: {
                name: 'react',
                chunks: 'all'
            }
        }
    }
}

Now he can only output a css file named react, And includes all the components in the style.

I don't know why this is, how can I solve it?

4

0 回答 0