I used splitchunks, and hope that when the build content changes, the name of the webpack chunk will also change accordingly. the configuration is as follows:
module.exports = {
output: {
filename: "[name].[chunkhash].js",
path: path.resolve(__dirname, 'dist'),
},
...,
optimization: {
minimize: false,
chunkIds: "named",
splitChunks: {
cacheGroups: {
antd: {
chunks: "all",
test: /antd/,
name: "antd.[chunkhash]",
enforce: true,
},
},
}
}
}
howover, the results obtained are not as expected.
The obtained dist directory file name is: antd.[chunkhash].72f43fcd3825cb3fe514.js
,
and the content is:
(self["webpackChunkmy_react_webpack_project"] = self["webpackChunkmy_react_webpack_project"] || []).push([["antd.[chunkhash]"],{ ... })
Does the splitchunks name option not support placeholders? If so, how do I get a build-related chunk name?