webpack/test/configCases/split-chunks-common/target-node/webpack.config.js

48 lines
874 B
JavaScript
Raw Normal View History

/** @type {import("../../../../").Configuration[]} */
module.exports = [
{
name: "default",
entry: "./index",
target: "node",
output: {
filename: "default-[name].js",
libraryTarget: "commonjs2"
},
optimization: {
splitChunks: {
minSize: 1,
chunks: "all"
}
}
},
{
name: "many-vendors",
entry: "./index",
target: "node",
output: {
filename: "many-vendors-[name].js",
libraryTarget: "commonjs2"
},
optimization: {
splitChunks: {
minSize: 1,
chunks: "all",
maxInitialRequests: Infinity,
cacheGroups: {
default: false,
defaultVendors: false,
vendors: {
test: /node_modules/,
name: m => {
2025-05-01 22:36:51 +08:00
const match =
/** @type {string} */
(m.nameForCondition()).match(/([b-d]+)\.js$/);
2024-07-31 10:39:30 +08:00
if (match) return `vendors-${match[1]}`;
}
}
}
}
}
}
];