MergeDuplicateChunksPlugin
Merges chunks that contain the same modules. This plugin is enabled by default as part of webpack's internal optimizations. Exporting it publicly allows developers to configure the stage at which merging occurs — useful when chunk merging needs to run after SplitChunksPlugin.
new webpack.optimize.MergeDuplicateChunksPlugin({
// Options...
});Options
stage
number
Controls the optimization stage at which duplicate chunk merging runs. By default, merging occurs before SplitChunksPlugin. Setting a stage greater than 10 (the stage of SplitChunksPlugin) causes merging to run after it; a value of 10 still runs before it because user plugins are applied first. The built-in instance (stage -10) stays active, so this adds a second merging pass.
webpack.config.js
import webpack from "webpack";
export default {
// ...
plugins: [
new webpack.optimize.MergeDuplicateChunksPlugin({
stage: 11, // run after SplitChunksPlugin (stage 10)
}),
],
};« Previous
ManifestPluginNext »
MinChunkSizePlugin


