2025-07-16 22:29:28 +08:00
|
|
|
"use strict";
|
|
|
|
|
2018-01-09 16:40:30 +08:00
|
|
|
const path = require("path");
|
2025-07-02 20:10:54 +08:00
|
|
|
|
2018-01-11 05:38:16 +08:00
|
|
|
const stats = {
|
|
|
|
hash: false,
|
|
|
|
timings: false,
|
2018-01-31 09:34:08 +08:00
|
|
|
builtAt: false,
|
2018-01-11 05:38:16 +08:00
|
|
|
assets: false,
|
|
|
|
chunks: true,
|
|
|
|
chunkOrigins: true,
|
|
|
|
modules: false
|
|
|
|
};
|
2025-05-01 22:36:51 +08:00
|
|
|
|
2020-04-20 15:23:10 +08:00
|
|
|
/** @type {import("../../../").Configuration[]} */
|
2018-01-11 05:38:16 +08:00
|
|
|
module.exports = [
|
|
|
|
{
|
2018-01-20 00:06:59 +08:00
|
|
|
name: "disabled",
|
2018-01-11 05:38:16 +08:00
|
|
|
mode: "production",
|
|
|
|
entry: {
|
|
|
|
main: "./",
|
|
|
|
a: "./a",
|
|
|
|
b: "./b",
|
|
|
|
c: "./c"
|
|
|
|
},
|
|
|
|
output: {
|
2018-01-20 00:06:59 +08:00
|
|
|
filename: "disabled/[name].js"
|
2018-01-11 05:38:16 +08:00
|
|
|
},
|
|
|
|
optimization: {
|
2018-01-20 00:06:59 +08:00
|
|
|
splitChunks: false
|
|
|
|
},
|
|
|
|
stats
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "default",
|
|
|
|
mode: "production",
|
|
|
|
entry: {
|
|
|
|
main: "./",
|
|
|
|
a: "./a",
|
|
|
|
b: "./b",
|
|
|
|
c: "./c"
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: "default/[name].js"
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
minSize: 0 // enforce all
|
2018-01-11 05:38:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
stats
|
2018-01-08 07:19:53 +08:00
|
|
|
},
|
2018-01-19 16:21:00 +08:00
|
|
|
|
2018-01-11 05:38:16 +08:00
|
|
|
{
|
2018-01-20 00:06:59 +08:00
|
|
|
name: "vendors",
|
2018-01-11 05:38:16 +08:00
|
|
|
mode: "production",
|
|
|
|
entry: {
|
|
|
|
main: "./",
|
|
|
|
a: "./a",
|
|
|
|
b: "./b",
|
|
|
|
c: "./c"
|
|
|
|
},
|
|
|
|
output: {
|
2018-01-20 00:06:59 +08:00
|
|
|
filename: "vendors/[name].js"
|
2018-01-11 05:38:16 +08:00
|
|
|
},
|
|
|
|
optimization: {
|
2018-01-20 00:06:59 +08:00
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
|
|
|
vendors: {
|
|
|
|
test: /[\\/]node_modules[\\/]/,
|
|
|
|
chunks: "initial",
|
|
|
|
name: "vendors",
|
|
|
|
enforce: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-01-11 05:38:16 +08:00
|
|
|
},
|
|
|
|
stats
|
2018-01-08 07:19:53 +08:00
|
|
|
},
|
2018-01-19 16:21:00 +08:00
|
|
|
|
2018-01-11 05:38:16 +08:00
|
|
|
{
|
2018-01-20 00:06:59 +08:00
|
|
|
name: "multiple-vendors",
|
2018-01-11 05:38:16 +08:00
|
|
|
mode: "production",
|
|
|
|
entry: {
|
|
|
|
main: "./",
|
|
|
|
a: "./a",
|
|
|
|
b: "./b",
|
2018-01-20 00:06:59 +08:00
|
|
|
c: "./c"
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
filename: "multiple-vendors/[name].js"
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
splitChunks: {
|
|
|
|
minSize: 0, // enforce all
|
|
|
|
chunks: "all",
|
|
|
|
cacheGroups: {
|
2025-07-17 00:13:14 +08:00
|
|
|
libs: (module) => {
|
2018-01-20 00:06:59 +08:00
|
|
|
const name = module.nameForCondition();
|
2018-07-25 18:12:17 +08:00
|
|
|
if (!name) return;
|
2018-01-20 00:06:59 +08:00
|
|
|
const match = /[\\/](xyz|x)\.js/.exec(name);
|
2025-07-02 20:10:54 +08:00
|
|
|
if (match) {
|
2018-02-25 09:00:20 +08:00
|
|
|
return {
|
2024-07-31 10:39:30 +08:00
|
|
|
name: `libs-${match[1]}`,
|
2018-02-25 09:00:20 +08:00
|
|
|
enforce: true
|
|
|
|
};
|
2025-07-02 20:10:54 +08:00
|
|
|
}
|
2018-01-20 00:06:59 +08:00
|
|
|
},
|
|
|
|
vendors: path.resolve(__dirname, "node_modules")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
stats
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "all",
|
|
|
|
mode: "production",
|
|
|
|
entry: {
|
|
|
|
main: "./",
|
|
|
|
a: "./a",
|
|
|
|
b: "./b",
|
|
|
|
c: "./c"
|
2018-01-11 05:38:16 +08:00
|
|
|
},
|
|
|
|
output: {
|
2018-01-20 00:06:59 +08:00
|
|
|
filename: "all/[name].js"
|
2018-01-11 05:38:16 +08:00
|
|
|
},
|
|
|
|
optimization: {
|
2018-01-20 00:06:59 +08:00
|
|
|
splitChunks: {
|
|
|
|
minSize: 0, // enforce all
|
|
|
|
chunks: "all",
|
|
|
|
cacheGroups: {
|
|
|
|
vendors: path.resolve(__dirname, "node_modules")
|
|
|
|
}
|
2018-01-11 05:38:16 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
stats
|
2018-01-08 07:19:53 +08:00
|
|
|
}
|
2018-01-11 05:38:16 +08:00
|
|
|
];
|