From fb2c24bf766529266b589b8e967ff09c35e83794 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 4 Jul 2018 09:59:22 +0200 Subject: [PATCH] add `splitChunks.maxSize` option add `splitChunks.fallbackCacheGroup` add `splitChunks.hidePathInfo` move `contextify` into utils add some types --- lib/Chunk.js | 2 + lib/ContextModule.js | 18 +- lib/Module.js | 2 + lib/NormalModule.js | 24 +- lib/WebpackOptionsDefaulter.js | 3 + lib/optimize/SplitChunksPlugin.js | 136 +++++++++- lib/util/deterministicGrouping.js | 251 ++++++++++++++++++ lib/util/identifier.js | 27 ++ schemas/WebpackOptions.json | 38 ++- .../__snapshots__/StatsTestCases.test.js.snap | 133 ++++++++++ test/statsCases/split-chunks-max-size/big.js | 4 + .../in-some-directory/big.js | 4 + .../in-some-directory/small.js | 1 + .../in-some-directory/very-big.js | 24 ++ .../statsCases/split-chunks-max-size/index.js | 43 +++ .../split-chunks-max-size/inner-module/big.js | 4 + .../inner-module/small.js | 1 + .../inner-module/very-big.js | 24 ++ .../statsCases/split-chunks-max-size/small.js | 1 + .../split-chunks-max-size/subfolder/big.js | 4 + .../split-chunks-max-size/subfolder/small.js | 1 + .../subfolder/very-big.js | 24 ++ .../split-chunks-max-size/very-big.js | 24 ++ .../split-chunks-max-size/webpack.config.js | 46 ++++ 24 files changed, 799 insertions(+), 40 deletions(-) create mode 100644 lib/util/deterministicGrouping.js create mode 100644 test/statsCases/split-chunks-max-size/big.js create mode 100644 test/statsCases/split-chunks-max-size/in-some-directory/big.js create mode 100644 test/statsCases/split-chunks-max-size/in-some-directory/small.js create mode 100644 test/statsCases/split-chunks-max-size/in-some-directory/very-big.js create mode 100644 test/statsCases/split-chunks-max-size/index.js create mode 100644 test/statsCases/split-chunks-max-size/inner-module/big.js create mode 100644 test/statsCases/split-chunks-max-size/inner-module/small.js create mode 100644 test/statsCases/split-chunks-max-size/inner-module/very-big.js create mode 100644 test/statsCases/split-chunks-max-size/small.js create mode 100644 test/statsCases/split-chunks-max-size/subfolder/big.js create mode 100644 test/statsCases/split-chunks-max-size/subfolder/small.js create mode 100644 test/statsCases/split-chunks-max-size/subfolder/very-big.js create mode 100644 test/statsCases/split-chunks-max-size/very-big.js create mode 100644 test/statsCases/split-chunks-max-size/webpack.config.js diff --git a/lib/Chunk.js b/lib/Chunk.js index 46cd61d456c..7d9ad3a05c5 100644 --- a/lib/Chunk.js +++ b/lib/Chunk.js @@ -121,6 +121,8 @@ class Chunk { this.entryModule = undefined; /** @private @type {SortableSet} */ this._modules = new SortableSet(undefined, sortByIdentifier); + /** @type {string?} */ + this.filenameTemplate = undefined; /** @private */ this._groups = new SortableSet(undefined, sortChunkGroupById); diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 175187a6973..9db2914b713 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -3,12 +3,12 @@ Author Tobias Koppers @sokra */ "use strict"; -const path = require("path"); const util = require("util"); const { OriginalSource, RawSource } = require("webpack-sources"); const Module = require("./Module"); const AsyncDependenciesBlock = require("./AsyncDependenciesBlock"); const Template = require("./Template"); +const contextify = require("./util/identifier").contextify; /** @typedef {import("./dependencies/ContextElementDependency")} ContextElementDependency */ @@ -63,18 +63,6 @@ class ContextModule extends Module { return regexString.substring(1, regexString.length - 1); } - contextify(context, request) { - return request - .split("!") - .map(subrequest => { - let rp = path.relative(context, subrequest); - if (path.sep === "\\") rp = rp.replace(/\\/g, "/"); - if (rp.indexOf("../") !== 0) rp = "./" + rp; - return rp; - }) - .join("!"); - } - _createIdentifier() { let identifier = this.context; if (this.options.resourceQuery) { @@ -155,7 +143,7 @@ class ContextModule extends Module { } libIdent(options) { - let identifier = this.contextify(options.context, this.context); + let identifier = contextify(options.context, this.context); if (this.options.mode) { identifier += ` ${this.options.mode}`; } @@ -163,7 +151,7 @@ class ContextModule extends Module { identifier += " recursive"; } if (this.options.addon) { - identifier += ` ${this.contextify(options.context, this.options.addon)}`; + identifier += ` ${contextify(options.context, this.options.addon)}`; } if (this.options.regExp) { identifier += ` ${this.prettyRegExp(this.options.regExp + "")}`; diff --git a/lib/Module.js b/lib/Module.js index 54997b54cb4..b0a533a85a4 100644 --- a/lib/Module.js +++ b/lib/Module.js @@ -384,6 +384,8 @@ Module.prototype.build = null; Module.prototype.source = null; Module.prototype.size = null; Module.prototype.nameForCondition = null; +/** @type {null | function(Chunk): boolean} */ +Module.prototype.chunkCondition = null; Module.prototype.updateCacheModule = null; module.exports = Module; diff --git a/lib/NormalModule.js b/lib/NormalModule.js index d22b2eac9b0..9c5dff5925d 100644 --- a/lib/NormalModule.js +++ b/lib/NormalModule.js @@ -4,7 +4,6 @@ */ "use strict"; -const path = require("path"); const NativeModule = require("module"); const { @@ -23,6 +22,7 @@ const ModuleBuildError = require("./ModuleBuildError"); const ModuleError = require("./ModuleError"); const ModuleWarning = require("./ModuleWarning"); const createHash = require("./util/createHash"); +const contextify = require("./util/identifier").contextify; const asString = buf => { if (Buffer.isBuffer(buf)) { @@ -38,28 +38,6 @@ const asBuffer = str => { return str; }; -const contextify = (context, request) => { - return request - .split("!") - .map(r => { - const splitPath = r.split("?"); - if (/^[a-zA-Z]:\\/.test(splitPath[0])) { - splitPath[0] = path.win32.relative(context, splitPath[0]); - if (!/^[a-zA-Z]:\\/.test(splitPath[0])) { - splitPath[0] = splitPath[0].replace(/\\/g, "/"); - } - } - if (/^\//.test(splitPath[0])) { - splitPath[0] = path.posix.relative(context, splitPath[0]); - } - if (!/^(\.\.\/|\/|[a-zA-Z]:\\)/.test(splitPath[0])) { - splitPath[0] = "./" + splitPath[0]; - } - return splitPath.join("?"); - }) - .join("!"); -}; - class NonErrorEmittedError extends WebpackError { constructor(error) { super(); diff --git a/lib/WebpackOptionsDefaulter.js b/lib/WebpackOptionsDefaulter.js index f0d3f8922e0..3f9da0b72d2 100644 --- a/lib/WebpackOptionsDefaulter.js +++ b/lib/WebpackOptionsDefaulter.js @@ -215,6 +215,9 @@ class WebpackOptionsDefaulter extends OptionsDefaulter { isProductionLikeMode(options) ); this.set("optimization.splitChunks", {}); + this.set("optimization.splitChunks.hidePathInfo", "make", options => { + return isProductionLikeMode(options); + }); this.set("optimization.splitChunks.chunks", "async"); this.set("optimization.splitChunks.minSize", "make", options => { return isProductionLikeMode(options) ? 30000 : 10000; diff --git a/lib/optimize/SplitChunksPlugin.js b/lib/optimize/SplitChunksPlugin.js index c49c5b1761e..d56e2699399 100644 --- a/lib/optimize/SplitChunksPlugin.js +++ b/lib/optimize/SplitChunksPlugin.js @@ -8,9 +8,16 @@ const crypto = require("crypto"); const SortableSet = require("../util/SortableSet"); const GraphHelpers = require("../GraphHelpers"); const { isSubset } = require("../util/SetHelpers"); +const deterministicGrouping = require("../util/deterministicGrouping"); +const contextify = require("../util/identifier").contextify; +/** @typedef {import("../Compiler")} Compiler */ /** @typedef {import("../Chunk")} Chunk */ /** @typedef {import("../Module")} Module */ +/** @typedef {import("../util/deterministicGrouping").Options} DeterministicGroupingOptionsForModule */ +/** @typedef {import("../util/deterministicGrouping").GroupedItems} DeterministicGroupingGroupedItemsForModule */ + +const deterministicGroupingForModules = /** @type {function(DeterministicGroupingOptionsForModule): DeterministicGroupingGroupedItemsForModule[]} */ (deterministicGrouping); const hashFilename = name => { return crypto @@ -104,6 +111,7 @@ module.exports = class SplitChunksPlugin { options.chunks || "all" ), minSize: options.minSize || 0, + maxSize: options.maxSize || 0, minChunks: options.minChunks || 1, maxAsyncRequests: options.maxAsyncRequests || 1, maxInitialRequests: options.maxInitialRequests || 1, @@ -112,11 +120,16 @@ module.exports = class SplitChunksPlugin { name: options.name, automaticNameDelimiter: options.automaticNameDelimiter }) || (() => {}), + hidePathInfo: options.hidePathInfo || false, filename: options.filename || undefined, getCacheGroups: SplitChunksPlugin.normalizeCacheGroups({ cacheGroups: options.cacheGroups, automaticNameDelimiter: options.automaticNameDelimiter - }) + }), + fallbackCacheGroup: SplitChunksPlugin.normalizeFallbackCacheGroup( + options.fallbackCacheGroup || {}, + options + ) }; } @@ -177,6 +190,26 @@ module.exports = class SplitChunksPlugin { if (typeof chunks === "function") return chunks; } + static normalizeFallbackCacheGroup( + { + minSize = undefined, + maxSize = undefined, + automaticNameDelimiter = undefined + }, + { + minSize: defaultMinSize = undefined, + maxSize: defaultMaxSize = undefined, + automaticNameDelimiter: defaultAutomaticNameDelimiter = undefined + } + ) { + return { + minSize: typeof minSize === "number" ? minSize : defaultMinSize || 0, + maxSize: typeof maxSize === "number" ? maxSize : defaultMaxSize || 0, + automaticNameDelimiter: + automaticNameDelimiter || defaultAutomaticNameDelimiter || "~" + }; + } + static normalizeCacheGroups({ cacheGroups, automaticNameDelimiter }) { if (typeof cacheGroups === "function") { // TODO webpack 5 remove this @@ -225,6 +258,7 @@ module.exports = class SplitChunksPlugin { ), enforce: option.enforce, minSize: option.minSize, + maxSize: option.maxSize, minChunks: option.minChunks, maxAsyncRequests: option.maxAsyncRequests, maxInitialRequests: option.maxInitialRequests, @@ -278,6 +312,10 @@ module.exports = class SplitChunksPlugin { return false; } + /** + * @param {Compiler} compiler webpack compiler + * @returns {void} + */ apply(compiler) { compiler.hooks.thisCompilation.tap("SplitChunksPlugin", compilation => { let alreadyOptimized = false; @@ -486,6 +524,12 @@ module.exports = class SplitChunksPlugin { : cacheGroupSource.enforce ? 0 : this.options.minSize, + maxSize: + cacheGroupSource.maxSize !== undefined + ? cacheGroupSource.maxSize + : cacheGroupSource.enforce + ? 0 + : this.options.maxSize, minChunks: cacheGroupSource.minChunks !== undefined ? cacheGroupSource.minChunks @@ -537,6 +581,9 @@ module.exports = class SplitChunksPlugin { } } + /** @type {Map} */ + const maxSizeQueueMap = new Map(); + while (chunksInfoMap.size > 0) { // Find best matching entry let bestEntryKey; @@ -563,6 +610,7 @@ module.exports = class SplitChunksPlugin { let chunkName = item.name; // Variable for the new chunk (lazy created) + /** @type {Chunk} */ let newChunk; // When no chunk name, check if we can reuse a chunk instead of creating a new one let isReused = false; @@ -689,6 +737,22 @@ module.exports = class SplitChunksPlugin { } } } + + if (item.cacheGroup.maxSize > 0) { + const oldMaxSizeSettings = maxSizeQueueMap.get(newChunk); + maxSizeQueueMap.set(newChunk, { + minSize: Math.max( + oldMaxSizeSettings ? oldMaxSizeSettings.minSize : 0, + item.cacheGroup.minSize + ), + maxSize: Math.min( + oldMaxSizeSettings ? oldMaxSizeSettings.maxSize : Infinity, + item.cacheGroup.maxSize + ), + automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter + }); + } + // remove all modules from other entries and update size for (const [key, info] of chunksInfoMap) { if (isOverlap(info.chunks, item.chunks)) { @@ -709,6 +773,76 @@ module.exports = class SplitChunksPlugin { } } } + + // Make sure that maxSize is fulfilled + for (const chunk of compilation.chunks.slice()) { + const { minSize, maxSize, automaticNameDelimiter } = + maxSizeQueueMap.get(chunk) || this.options.fallbackCacheGroup; + if (!maxSize) continue; + const results = deterministicGroupingForModules({ + maxSize, + minSize, + items: chunk.modulesIterable, + getKey(module) { + const ident = contextify( + compilation.options.context, + module.identifier() + ); + const name = module.nameForCondition + ? contextify( + compilation.options.context, + module.nameForCondition() + ) + : ident.replace(/^.*!|\?[^?!]*$/g, ""); + const fullKey = + name + automaticNameDelimiter + hashFilename(ident); + return fullKey.replace(/[\\/?]/g, "_"); + }, + getSize(module) { + return module.size(); + } + }); + results.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + for (let i = 0; i < results.length; i++) { + const group = results[i]; + const key = this.options.hidePathInfo + ? hashFilename(group.key) + : group.key; + let name = chunk.name + ? chunk.name + automaticNameDelimiter + key + : null; + if (name && name.length > 100) { + name = + name.slice(0, 100) + + automaticNameDelimiter + + hashFilename(name); + } + let newPart; + if (i !== results.length - 1) { + newPart = compilation.addChunk(name); + chunk.split(newPart); + // Add all modules to the new chunk + for (const module of group.items) { + if (typeof module.chunkCondition === "function") { + if (!module.chunkCondition(newPart)) continue; + } + // Add module to new chunk + GraphHelpers.connectChunkAndModule(newPart, module); + // Remove module from used chunks + chunk.removeModule(module); + module.rewriteChunkInReasons(chunk, [newPart]); + } + } else { + // change the chunk to be a part + newPart = chunk; + chunk.name = name; + } + } + } } ); }); diff --git a/lib/util/deterministicGrouping.js b/lib/util/deterministicGrouping.js new file mode 100644 index 00000000000..75827b0c1bb --- /dev/null +++ b/lib/util/deterministicGrouping.js @@ -0,0 +1,251 @@ +"use strict"; + +// Simulations show these probabilities for a single change +// 93.1% that one group is invalidated +// 4.8% that two groups are invalidated +// 1.1% that 3 groups are invalidated +// 0.1% that 4 or more groups are invalidated +// +// And these for removing/adding 10 lexically adjacent files +// 64.5% that one group is invalidated +// 24.8% that two groups are invalidated +// 7.8% that 3 groups are invalidated +// 2.7% that 4 or more groups are invalidated +// +// And these for removing/adding 3 random files +// 0% that one group is invalidated +// 3.7% that two groups are invalidated +// 80.8% that 3 groups are invalidated +// 12.3% that 4 groups are invalidated +// 3.2% that 5 or more groups are invalidated + +/** + * + * @param {string} a key + * @param {string} b key + * @returns {number} the similarity as number + */ +const similarity = (a, b) => { + const l = Math.min(a.length, b.length); + let dist = 0; + for (let i = 0; i < l; i++) { + const ca = a.charCodeAt(i); + const cb = b.charCodeAt(i); + dist += Math.max(0, 10 - Math.abs(ca - cb)); + } + return dist; +}; + +/** + * @param {string} a key + * @param {string} b key + * @returns {string} the common part and a single char for the difference + */ +const getName = (a, b) => { + const l = Math.min(a.length, b.length); + let r = ""; + for (let i = 0; i < l; i++) { + const ca = a.charAt(i); + const cb = b.charAt(i); + r += ca; + if (ca === cb) { + continue; + } + return r; + } + return a; +}; + +/** + * @template T + */ +class Node { + /** + * @param {T} item item + * @param {string} key key + * @param {number} size size + */ + constructor(item, key, size) { + this.item = item; + this.key = key; + this.size = size; + } +} + +/** + * @template T + */ +class Group { + /** + * @param {Node[]} nodes nodes + * @param {number[]} similarities similarities between the nodes (length = nodes.length - 1) + */ + constructor(nodes, similarities) { + this.nodes = nodes; + this.similarities = similarities; + this.size = nodes.reduce((size, node) => size + node.size, 0); + /** @type {string} */ + this.key = undefined; + } +} + +/** + * @template T + * @typedef {Object} GroupedItems + * @property {string} key + * @property {T[]} items + * @property {number} size + */ + +/** + * @template T + * @typedef {Object} Options + * @property {number} maxSize maximum size of a group + * @property {number} minSize minimum size of a group (preferred over maximum size) + * @property {Iterable} items a list of items + * @property {function(T): number} getSize function to get size of an item + * @property {function(T): string} getKey function to get the key of an item + */ + +/** + * @template T + * @param {Options} options options object + * @returns {GroupedItems[]} grouped items + */ +module.exports = ({ maxSize, minSize, items, getSize, getKey }) => { + /** @type {Group[]} */ + const result = []; + + const nodes = Array.from( + items, + item => new Node(item, getKey(item), getSize(item)) + ); + + /** @type {Node[]} */ + const initialNodes = []; + + // return nodes bigger than maxSize directly as group + for (const node of nodes) { + if (node.size >= maxSize) { + result.push(new Group([node], [])); + } else { + initialNodes.push(node); + } + } + + if (initialNodes.length > 0) { + // lexically ordering of keys + initialNodes.sort((a, b) => { + if (a.key < b.key) return -1; + if (a.key > b.key) return 1; + return 0; + }); + + // calculate similarities between lexically adjacent nodes + /** @type {number[]} */ + const similarities = []; + for (let i = 1; i < initialNodes.length; i++) { + const a = initialNodes[i - 1]; + const b = initialNodes[i]; + similarities.push(similarity(a.key, b.key)); + } + + const queue = [new Group(initialNodes, similarities)]; + + while (queue.length) { + const group = queue.pop(); + // only groups bigger than maxSize need to be splitted + if (group.size < maxSize) { + result.push(group); + continue; + } + + // find unsplittable area from left and right + // going minSize from left and right + let left = 0; + let leftSize = 0; + while (leftSize < minSize) { + leftSize += group.nodes[left].size; + left++; + } + let right = group.nodes.length - 1; + let rightSize = 0; + while (rightSize < minSize) { + rightSize += group.nodes[right].size; + right--; + } + + if (left - 1 > right) { + // can't split group while holding minSize + // because minSize is preferred of maxSize we return + // the group here even while it's too big + // To avoid this make sure maxSize > minSize * 3 + result.push(group); + continue; + } + if (left <= right) { + // when there is a area between left and right + // we look for best split point + // we split at the minimum similiarity + // here key space is separated the most + let best = left - 1; + let bestSimilarity = group.similarities[best]; + for (let i = left; i <= right; i++) { + const similarity = group.similarities[i]; + if (similarity < bestSimilarity) { + best = i; + bestSimilarity = similarity; + } + } + left = best + 1; + right = best; + } + + // create two new groups for left and right area + // and queue them up + const rightNodes = [group.nodes[right + 1]]; + /** @type {number[]} */ + const rightSimilaries = []; + for (let i = right + 2; i < group.nodes.length; i++) { + rightSimilaries.push(group.similarities[i - 1]); + rightNodes.push(group.nodes[i]); + } + queue.push(new Group(rightNodes, rightSimilaries)); + + const leftNodes = [group.nodes[0]]; + /** @type {number[]} */ + const leftSimilaries = []; + for (let i = 1; i < left; i++) { + leftSimilaries.push(group.similarities[i - 1]); + leftNodes.push(group.nodes[i]); + } + queue.push(new Group(leftNodes, leftSimilaries)); + } + } + + // lexically ordering + result.sort((a, b) => { + if (a.nodes[0].key < b.nodes[0].key) return -1; + if (a.nodes[0].key > b.nodes[0].key) return 1; + return 0; + }); + + // give every group a name + for (let i = 0; i < result.length; i++) { + const group = result[i]; + const first = group.nodes[0]; + const last = group.nodes[group.nodes.length - 1]; + let name = getName(first.key, last.key); + group.key = name; + } + + // return the results + return result.map(group => { + /** @type {GroupedItems} */ + return { + key: group.key, + items: group.nodes.map(node => node.item), + size: group.size + }; + }); +}; diff --git a/lib/util/identifier.js b/lib/util/identifier.js index 9176facd0fd..ade63590821 100644 --- a/lib/util/identifier.js +++ b/lib/util/identifier.js @@ -74,3 +74,30 @@ exports.makePathsRelative = (context, identifier, cache) => { return relativePath; } }; + +/** + * @param {string} context absolute context path + * @param {string} request any request string may containing absolute paths, query string, etc. + * @returns {string} a new request string avoiding absolute paths when possible + */ +exports.contextify = (context, request) => { + return request + .split("!") + .map(r => { + const splitPath = r.split("?", 2); + if (/^[a-zA-Z]:\\/.test(splitPath[0])) { + splitPath[0] = path.win32.relative(context, splitPath[0]); + if (!/^[a-zA-Z]:\\/.test(splitPath[0])) { + splitPath[0] = splitPath[0].replace(/\\/g, "/"); + } + } + if (/^\//.test(splitPath[0])) { + splitPath[0] = path.posix.relative(context, splitPath[0]); + } + if (!/^(\.\.\/|\/|[a-zA-Z]:\\)/.test(splitPath[0])) { + splitPath[0] = "./" + splitPath[0]; + } + return splitPath.join("?"); + }) + .join("!"); +}; diff --git a/schemas/WebpackOptions.json b/schemas/WebpackOptions.json index 2fe65fb16b3..7581fe8dd22 100644 --- a/schemas/WebpackOptions.json +++ b/schemas/WebpackOptions.json @@ -1351,7 +1351,12 @@ ] }, "minSize": { - "description": "Minimal size for the created chunk", + "description": "Minimal size for the created chunks", + "type": "number", + "minimum": 0 + }, + "maxSize": { + "description": "Maximal size hint for the created chunks", "type": "number", "minimum": 0 }, @@ -1394,6 +1399,32 @@ "type": "string", "minLength": 1 }, + "hidePathInfo": { + "description": "Prevents exposing path info when creating names for parts splitted by maxSize", + "type": "boolean" + }, + "fallbackCacheGroup": { + "description": "Options for modules not selected by any other cache group", + "type": "object", + "additionalProperties": false, + "properties": { + "minSize": { + "description": "Minimal size for the created chunk", + "type": "number", + "minimum": 0 + }, + "maxSize": { + "description": "Maximal size hint for the created chunks", + "type": "number", + "minimum": 0 + }, + "automaticNameDelimiter": { + "description": "Sets the name delimiter for created chunks", + "type": "string", + "minLength": 1 + } + } + }, "cacheGroups": { "description": "Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks)", "type": "object", @@ -1460,6 +1491,11 @@ "type": "number", "minimum": 0 }, + "maxSize": { + "description": "Maximal size hint for the created chunks", + "type": "number", + "minimum": 0 + }, "minChunks": { "description": "Minimum number of times a module has to be duplicated until it's considered for splitting", "type": "number", diff --git a/test/__snapshots__/StatsTestCases.test.js.snap b/test/__snapshots__/StatsTestCases.test.js.snap index 3808b4ea6a8..ca7b99a36fc 100644 --- a/test/__snapshots__/StatsTestCases.test.js.snap +++ b/test/__snapshots__/StatsTestCases.test.js.snap @@ -2772,6 +2772,139 @@ chunk {3} b.js (b) 43 bytes >{0}< >{1}< [entry] [rendered] [3] ./b.js 43 bytes {3} [built]" `; +exports[`StatsTestCases should print correct stats for split-chunks-max-size 1`] = ` +"Child production: + Entrypoint main = prod-main~6e7ead72.js prod-main~6a2ae26b.js prod-main~17acad98.js prod-main~b2c7414a.js prod-main~75f09de8.js prod-main~052b3814.js prod-main~3ff27526.js prod-main~11485824.js prod-main~c6931360.js prod-main~cd7c5bfc.js prod-main~02369f19.js + chunk {0} prod-main~02369f19.js (main~02369f19) 1.57 KiB ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [entry] [rendered] + > ./ main + [11] ./very-big.js?1 1.57 KiB {0} [built] + chunk {1} prod-main~6e7ead72.js (main~6e7ead72) 536 bytes ={0}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [0] ./big.js?1 268 bytes {1} [built] + [1] ./big.js?2 268 bytes {1} [built] + chunk {2} prod-main~6a2ae26b.js (main~6a2ae26b) 536 bytes ={0}= ={1}= ={10}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [34] ./in-some-directory/big.js?1 268 bytes {2} [built] + [35] ./in-some-directory/small.js?1 67 bytes {2} [built] + [36] ./in-some-directory/small.js?2 67 bytes {2} [built] + [37] ./in-some-directory/small.js?3 67 bytes {2} [built] + [38] ./in-some-directory/small.js?4 67 bytes {2} [built] + chunk {3} prod-main~17acad98.js (main~17acad98) 1.57 KiB ={0}= ={1}= ={10}= ={2}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [39] ./in-some-directory/very-big.js?1 1.57 KiB {3} [built] + chunk {4} prod-main~b2c7414a.js (main~b2c7414a) 1.11 KiB ={0}= ={1}= ={10}= ={2}= ={3}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [40] ./index.js 1.11 KiB {4} [built] + chunk {5} prod-main~75f09de8.js (main~75f09de8) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [25] ./inner-module/small.js?1 67 bytes {5} [built] + [26] ./inner-module/small.js?2 67 bytes {5} [built] + [27] ./inner-module/small.js?3 67 bytes {5} [built] + [28] ./inner-module/small.js?4 67 bytes {5} [built] + [29] ./inner-module/small.js?5 67 bytes {5} [built] + [30] ./inner-module/small.js?6 67 bytes {5} [built] + [31] ./inner-module/small.js?7 67 bytes {5} [built] + [32] ./inner-module/small.js?8 67 bytes {5} [built] + [33] ./inner-module/small.js?9 67 bytes {5} [built] + chunk {6} prod-main~052b3814.js (main~052b3814) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [2] ./small.js?1 67 bytes {6} [built] + [3] ./small.js?2 67 bytes {6} [built] + [4] ./small.js?3 67 bytes {6} [built] + [5] ./small.js?4 67 bytes {6} [built] + [6] ./small.js?5 67 bytes {6} [built] + [7] ./small.js?6 67 bytes {6} [built] + [8] ./small.js?7 67 bytes {6} [built] + [9] ./small.js?8 67 bytes {6} [built] + [10] ./small.js?9 67 bytes {6} [built] + chunk {7} prod-main~3ff27526.js (main~3ff27526) 536 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={8}= ={9}= [initial] [rendered] + > ./ main + [14] ./subfolder/big.js?1 268 bytes {7} [built] + [15] ./subfolder/big.js?2 268 bytes {7} [built] + chunk {8} prod-main~11485824.js (main~11485824) 603 bytes ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={9}= [initial] [rendered] + > ./ main + [16] ./subfolder/small.js?1 67 bytes {8} [built] + [17] ./subfolder/small.js?2 67 bytes {8} [built] + [18] ./subfolder/small.js?3 67 bytes {8} [built] + [19] ./subfolder/small.js?4 67 bytes {8} [built] + [20] ./subfolder/small.js?5 67 bytes {8} [built] + [21] ./subfolder/small.js?6 67 bytes {8} [built] + [22] ./subfolder/small.js?7 67 bytes {8} [built] + [23] ./subfolder/small.js?8 67 bytes {8} [built] + [24] ./subfolder/small.js?9 67 bytes {8} [built] + chunk {9} prod-main~c6931360.js (main~c6931360) 1.57 KiB ={0}= ={1}= ={10}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= [initial] [rendered] + > ./ main + [12] ./very-big.js?2 1.57 KiB {9} [built] + chunk {10} prod-main~cd7c5bfc.js (main~cd7c5bfc) 1.57 KiB ={0}= ={1}= ={2}= ={3}= ={4}= ={5}= ={6}= ={7}= ={8}= ={9}= [initial] [rendered] + > ./ main + [13] ./very-big.js?3 1.57 KiB {10} [built] +Child development: + Entrypoint main = dev-main~._big.js~1.js dev-main~._in-some-directory_b.js dev-main~._in-some-directory_very-big.js~8d76cf03.js dev-main~._index.js~41f5a26e.js dev-main~._inner-module_small.js~3.js dev-main~._small.js~1.js dev-main~._subfolder_big.js~b.js dev-main~._subfolder_small.js~1.js dev-main~._very-big.js~08cf55cf.js dev-main~._very-big.js~4647fb9d.js dev-main~._very-big.js~62f7f644.js + chunk {main~._big.js~1} dev-main~._big.js~1.js (main~._big.js~1) 536 bytes ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./big.js?1] 268 bytes {main~._big.js~1} [built] + [./big.js?2] 268 bytes {main~._big.js~1} [built] + chunk {main~._in-some-directory_b} dev-main~._in-some-directory_b.js (main~._in-some-directory_b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./in-some-directory/big.js?1] 268 bytes {main~._in-some-directory_b} [built] + [./in-some-directory/small.js?1] 67 bytes {main~._in-some-directory_b} [built] + [./in-some-directory/small.js?2] 67 bytes {main~._in-some-directory_b} [built] + [./in-some-directory/small.js?3] 67 bytes {main~._in-some-directory_b} [built] + [./in-some-directory/small.js?4] 67 bytes {main~._in-some-directory_b} [built] + chunk {main~._in-some-directory_very-big.js~8d76cf03} dev-main~._in-some-directory_very-big.js~8d76cf03.js (main~._in-some-directory_very-big.js~8d76cf03) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./in-some-directory/very-big.js?1] 1.57 KiB {main~._in-some-directory_very-big.js~8d76cf03} [built] + chunk {main~._index.js~41f5a26e} dev-main~._index.js~41f5a26e.js (main~._index.js~41f5a26e) 1.11 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./index.js] 1.11 KiB {main~._index.js~41f5a26e} [built] + chunk {main~._inner-module_small.js~3} dev-main~._inner-module_small.js~3.js (main~._inner-module_small.js~3) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./inner-module/small.js?1] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?2] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?3] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?4] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?5] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?6] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?7] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?8] 67 bytes {main~._inner-module_small.js~3} [built] + [./inner-module/small.js?9] 67 bytes {main~._inner-module_small.js~3} [built] + chunk {main~._small.js~1} dev-main~._small.js~1.js (main~._small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./small.js?1] 67 bytes {main~._small.js~1} [built] + [./small.js?2] 67 bytes {main~._small.js~1} [built] + [./small.js?3] 67 bytes {main~._small.js~1} [built] + [./small.js?4] 67 bytes {main~._small.js~1} [built] + [./small.js?5] 67 bytes {main~._small.js~1} [built] + [./small.js?6] 67 bytes {main~._small.js~1} [built] + [./small.js?7] 67 bytes {main~._small.js~1} [built] + [./small.js?8] 67 bytes {main~._small.js~1} [built] + [./small.js?9] 67 bytes {main~._small.js~1} [built] + chunk {main~._subfolder_big.js~b} dev-main~._subfolder_big.js~b.js (main~._subfolder_big.js~b) 536 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./subfolder/big.js?1] 268 bytes {main~._subfolder_big.js~b} [built] + [./subfolder/big.js?2] 268 bytes {main~._subfolder_big.js~b} [built] + chunk {main~._subfolder_small.js~1} dev-main~._subfolder_small.js~1.js (main~._subfolder_small.js~1) 603 bytes ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./subfolder/small.js?1] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?2] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?3] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?4] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?5] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?6] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?7] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?8] 67 bytes {main~._subfolder_small.js~1} [built] + [./subfolder/small.js?9] 67 bytes {main~._subfolder_small.js~1} [built] + chunk {main~._very-big.js~08cf55cf} dev-main~._very-big.js~08cf55cf.js (main~._very-big.js~08cf55cf) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~4647fb9d}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./very-big.js?2] 1.57 KiB {main~._very-big.js~08cf55cf} [built] + chunk {main~._very-big.js~4647fb9d} dev-main~._very-big.js~4647fb9d.js (main~._very-big.js~4647fb9d) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~62f7f644}= [initial] [rendered] + > ./ main + [./very-big.js?3] 1.57 KiB {main~._very-big.js~4647fb9d} [built] + chunk {main~._very-big.js~62f7f644} dev-main~._very-big.js~62f7f644.js (main~._very-big.js~62f7f644) 1.57 KiB ={main~._big.js~1}= ={main~._in-some-directory_b}= ={main~._in-some-directory_very-big.js~8d76cf03}= ={main~._index.js~41f5a26e}= ={main~._inner-module_small.js~3}= ={main~._small.js~1}= ={main~._subfolder_big.js~b}= ={main~._subfolder_small.js~1}= ={main~._very-big.js~08cf55cf}= ={main~._very-big.js~4647fb9d}= [entry] [rendered] + > ./ main + [./very-big.js?1] 1.57 KiB {main~._very-big.js~62f7f644} [built]" +`; + exports[`StatsTestCases should print correct stats for split-chunks-prefer-bigger-splits 1`] = ` "Entrypoint main = default/main.js chunk {0} default/async-b~async-c.js (async-b~async-c) 110 bytes <{4}> ={2}= ={3}= [rendered] split chunk (cache group: default) (name: async-b~async-c) diff --git a/test/statsCases/split-chunks-max-size/big.js b/test/statsCases/split-chunks-max-size/big.js new file mode 100644 index 00000000000..40380e42352 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/big.js @@ -0,0 +1,4 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/in-some-directory/big.js b/test/statsCases/split-chunks-max-size/in-some-directory/big.js new file mode 100644 index 00000000000..40380e42352 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/in-some-directory/big.js @@ -0,0 +1,4 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/in-some-directory/small.js b/test/statsCases/split-chunks-max-size/in-some-directory/small.js new file mode 100644 index 00000000000..1f44b439eae --- /dev/null +++ b/test/statsCases/split-chunks-max-size/in-some-directory/small.js @@ -0,0 +1 @@ +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/in-some-directory/very-big.js b/test/statsCases/split-chunks-max-size/in-some-directory/very-big.js new file mode 100644 index 00000000000..4c943771c37 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/in-some-directory/very-big.js @@ -0,0 +1,24 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/index.js b/test/statsCases/split-chunks-max-size/index.js new file mode 100644 index 00000000000..5b5a81edd66 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/index.js @@ -0,0 +1,43 @@ +import "./big?1"; +import "./big?2"; +import "./small?1"; +import "./small?2"; +import "./small?3"; +import "./small?4"; +import "./small?5"; +import "./small?6"; +import "./small?7"; +import "./small?8"; +import "./small?9"; +import "./very-big?1"; +import "./very-big?2"; +import "./very-big?3"; + +import "./subfolder/big?1"; +import "./subfolder/big?2"; +import "./subfolder/small?1"; +import "./subfolder/small?2"; +import "./subfolder/small?3"; +import "./subfolder/small?4"; +import "./subfolder/small?5"; +import "./subfolder/small?6"; +import "./subfolder/small?7"; +import "./subfolder/small?8"; +import "./subfolder/small?9"; + +import "./inner-module/small?1"; +import "./inner-module/small?2"; +import "./inner-module/small?3"; +import "./inner-module/small?4"; +import "./inner-module/small?5"; +import "./inner-module/small?6"; +import "./inner-module/small?7"; +import "./inner-module/small?8"; +import "./inner-module/small?9"; + +import "./in-some-directory/big?1"; +import "./in-some-directory/small?1"; +import "./in-some-directory/small?2"; +import "./in-some-directory/small?3"; +import "./in-some-directory/small?4"; +import "./in-some-directory/very-big?1"; diff --git a/test/statsCases/split-chunks-max-size/inner-module/big.js b/test/statsCases/split-chunks-max-size/inner-module/big.js new file mode 100644 index 00000000000..40380e42352 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/inner-module/big.js @@ -0,0 +1,4 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/inner-module/small.js b/test/statsCases/split-chunks-max-size/inner-module/small.js new file mode 100644 index 00000000000..1f44b439eae --- /dev/null +++ b/test/statsCases/split-chunks-max-size/inner-module/small.js @@ -0,0 +1 @@ +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/inner-module/very-big.js b/test/statsCases/split-chunks-max-size/inner-module/very-big.js new file mode 100644 index 00000000000..4c943771c37 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/inner-module/very-big.js @@ -0,0 +1,24 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/small.js b/test/statsCases/split-chunks-max-size/small.js new file mode 100644 index 00000000000..1f44b439eae --- /dev/null +++ b/test/statsCases/split-chunks-max-size/small.js @@ -0,0 +1 @@ +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/subfolder/big.js b/test/statsCases/split-chunks-max-size/subfolder/big.js new file mode 100644 index 00000000000..40380e42352 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/subfolder/big.js @@ -0,0 +1,4 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/subfolder/small.js b/test/statsCases/split-chunks-max-size/subfolder/small.js new file mode 100644 index 00000000000..1f44b439eae --- /dev/null +++ b/test/statsCases/split-chunks-max-size/subfolder/small.js @@ -0,0 +1 @@ +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/subfolder/very-big.js b/test/statsCases/split-chunks-max-size/subfolder/very-big.js new file mode 100644 index 00000000000..4c943771c37 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/subfolder/very-big.js @@ -0,0 +1,24 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/very-big.js b/test/statsCases/split-chunks-max-size/very-big.js new file mode 100644 index 00000000000..4c943771c37 --- /dev/null +++ b/test/statsCases/split-chunks-max-size/very-big.js @@ -0,0 +1,24 @@ +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content +// content content content content content content content content diff --git a/test/statsCases/split-chunks-max-size/webpack.config.js b/test/statsCases/split-chunks-max-size/webpack.config.js new file mode 100644 index 00000000000..3987fc2a86f --- /dev/null +++ b/test/statsCases/split-chunks-max-size/webpack.config.js @@ -0,0 +1,46 @@ +const stats = { + hash: false, + timings: false, + builtAt: false, + assets: false, + chunks: true, + chunkOrigins: true, + entrypoints: true, + modules: false +}; +module.exports = [ + { + name: "production", + mode: "production", + entry: { + main: "./" + }, + output: { + filename: "prod-[name].js" + }, + optimization: { + splitChunks: { + minSize: 100, + maxSize: 1000 + } + }, + stats + }, + { + name: "development", + mode: "development", + entry: { + main: "./" + }, + output: { + filename: "dev-[name].js" + }, + optimization: { + splitChunks: { + minSize: 100, + maxSize: 1000 + } + }, + stats + } +];