update splitChunks defaults for automatic async max size
This commit is contained in:
parent
762155dc2d
commit
c5f033a18a
|
@ -258,14 +258,28 @@ class WebpackOptionsDefaulter extends OptionsDefaulter {
|
|||
this.set("optimization.splitChunks.chunks", "async");
|
||||
this.set("optimization.splitChunks.minChunks", 1);
|
||||
this.set("optimization.splitChunks.minSize", "make", options => {
|
||||
return isProductionLikeMode(options) ? 30000 : 10000;
|
||||
return isWebLikeTarget(options) && isProductionLikeMode(options)
|
||||
? 30000
|
||||
: 10000;
|
||||
});
|
||||
this.set("optimization.splitChunks.maxAsyncRequests", "make", options => {
|
||||
return isProductionLikeMode(options) ? 6 : Infinity;
|
||||
return isWebLikeTarget(options) && isProductionLikeMode(options)
|
||||
? 6
|
||||
: Infinity;
|
||||
});
|
||||
this.set("optimization.splitChunks.maxAsyncSize", "make", options => {
|
||||
if (options.optimization.splitChunks.maxSize) return undefined;
|
||||
if (isWebLikeTarget(options)) {
|
||||
return isProductionLikeMode(options) ? 100000 : 50000;
|
||||
} else {
|
||||
return 1000000;
|
||||
}
|
||||
});
|
||||
this.set("optimization.splitChunks.automaticNameDelimiter", "-");
|
||||
this.set("optimization.splitChunks.maxInitialRequests", "make", options => {
|
||||
return isProductionLikeMode(options) ? 4 : Infinity;
|
||||
return isWebLikeTarget(options) && isProductionLikeMode(options)
|
||||
? 4
|
||||
: Infinity;
|
||||
});
|
||||
this.set("optimization.splitChunks.cacheGroups", {});
|
||||
this.set("optimization.splitChunks.cacheGroups.default", {
|
||||
|
|
|
@ -1170,7 +1170,7 @@ module.exports = class SplitChunksPlugin {
|
|||
return size;
|
||||
}
|
||||
});
|
||||
if (results.length === 0) {
|
||||
if (results.length < 2) {
|
||||
continue;
|
||||
}
|
||||
results.sort((a, b) => {
|
||||
|
|
|
@ -3460,7 +3460,7 @@ WARNING in Terser Plugin: Dropping unused function someUnRemoteUsedFunction5 [./
|
|||
`;
|
||||
|
||||
exports[`StatsTestCases should print correct stats for wasm-explorer-examples-sync 1`] = `
|
||||
"Hash: 6f7419bf98dbc8f6c48b
|
||||
"Hash: 8851298db45f5984d400
|
||||
Time: Xms
|
||||
Built at: Thu Jan 01 1970 00:00:00 GMT
|
||||
Asset Size Chunks Chunk Names
|
||||
|
@ -3473,13 +3473,10 @@ Built at: Thu Jan 01 1970 00:00:00 GMT
|
|||
480.bundle.js 329 bytes {480} [emitted]
|
||||
52d54005d2a6b6900686.module.wasm 511 bytes {363} [emitted]
|
||||
827.bundle.js 3.93 KiB {827} [emitted]
|
||||
bundle.js 13.2 KiB {73} [emitted] main-1df31ce3
|
||||
bundle.js 13.2 KiB {404} [emitted] main
|
||||
d0e21fa2a830ae6b73b3.module.wasm 95 bytes {827} [emitted]
|
||||
f0c2bdc23c3fd35aa84b.module.wasm 132 bytes {286} [emitted]
|
||||
Entrypoint main = bundle.js
|
||||
chunk {73} bundle.js (main-1df31ce3) 586 bytes (javascript) 6.53 KiB (runtime) [entry] [rendered]
|
||||
[967] ./index.js 586 bytes {73} [built]
|
||||
+ 7 hidden chunk modules
|
||||
chunk {147} 147.bundle.js, 34140a4a1dc9a799f361.module.wasm, 020fc90be64ae1360e8f.module.wasm 205 bytes (javascript) 444 bytes (webassembly) [rendered]
|
||||
[412] ./fact.wasm 100 bytes (javascript) 154 bytes (webassembly) {147} [built]
|
||||
[987] ./fast-math.wasm 105 bytes (javascript) 290 bytes (webassembly) {147} [built]
|
||||
|
@ -3487,6 +3484,9 @@ chunk {286} 286.bundle.js, f0c2bdc23c3fd35aa84b.module.wasm 100 bytes (javascrip
|
|||
[286] ./Q_rsqrt.wasm 100 bytes (javascript) 156 bytes (webassembly) {286} [built]
|
||||
chunk {363} 363.bundle.js, 52d54005d2a6b6900686.module.wasm 100 bytes (javascript) 531 bytes (webassembly) [rendered]
|
||||
[363] ./duff.wasm 100 bytes (javascript) 531 bytes (webassembly) {363} [built]
|
||||
chunk {404} bundle.js (main) 586 bytes (javascript) 6.53 KiB (runtime) [entry] [rendered]
|
||||
[967] ./index.js 586 bytes {404} [built]
|
||||
+ 7 hidden chunk modules
|
||||
chunk {480} 480.bundle.js 34 bytes [rendered] split chunk (cache group: defaultVendors)
|
||||
[480] ./node_modules/env.js 34 bytes {480} [built]
|
||||
chunk {827} 827.bundle.js, d0e21fa2a830ae6b73b3.module.wasm, 35eb8bb1d55d3a57c0a6.module.wasm 1.6 KiB (javascript) 274 bytes (webassembly) [rendered]
|
||||
|
@ -3499,7 +3499,7 @@ chunk {827} 827.bundle.js, d0e21fa2a830ae6b73b3.module.wasm, 35eb8bb1d55d3a57c0a
|
|||
[480] ./node_modules/env.js 34 bytes {480} [built]
|
||||
[827] ./tests.js 1.4 KiB {827} [built]
|
||||
[896] ./popcnt.wasm 100 bytes (javascript) 120 bytes (webassembly) {827} [built]
|
||||
[967] ./index.js 586 bytes {73} [built]
|
||||
[967] ./index.js 586 bytes {404} [built]
|
||||
[987] ./fast-math.wasm 105 bytes (javascript) 290 bytes (webassembly) {147} [built]
|
||||
[999] ./testFunction.wasm 100 bytes (javascript) 154 bytes (webassembly) {827} [built]
|
||||
+ 7 hidden modules"
|
||||
|
|
Loading…
Reference in New Issue