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

46 lines
834 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 => {
const match = m.nameForCondition().match(/([b-d]+)\.js$/);
2019-02-19 15:58:46 +08:00
if (match) return "vendors-" + match[1];
}
}
}
}
}
}
];