| | |
| | | /** @typedef {import("../Compiler")} Compiler */ |
| | | |
| | | /** |
| | | * Defines the aggressive merging plugin options type used by this module. |
| | | * @typedef {object} AggressiveMergingPluginOptions |
| | | * @property {number=} minSizeReduce minimal size reduction to trigger merging |
| | | */ |
| | |
| | | |
| | | class AggressiveMergingPlugin { |
| | | /** |
| | | * Creates an instance of AggressiveMergingPlugin. |
| | | * @param {AggressiveMergingPluginOptions=} options options object |
| | | */ |
| | | constructor(options) { |
| | |
| | | "Argument should be an options object. To use defaults, pass in nothing.\nFor more info on options, see https://webpack.js.org/plugins/" |
| | | ); |
| | | } |
| | | /** @type {AggressiveMergingPluginOptions} */ |
| | | this.options = options || {}; |
| | | } |
| | | |
| | | /** |
| | | * Apply the plugin |
| | | * Applies the plugin by registering its hooks on the compiler. |
| | | * @param {Compiler} compiler the compiler instance |
| | | * @returns {void} |
| | | */ |
| | |
| | | }, |
| | | (chunks) => { |
| | | const chunkGraph = compilation.chunkGraph; |
| | | /** @type {{a: Chunk, b: Chunk, improvement: number}[]} */ |
| | | /** @type {{ a: Chunk, b: Chunk, improvement: number }[]} */ |
| | | const combinations = []; |
| | | for (const a of chunks) { |
| | | if (a.canBeInitial()) continue; |