2016-01-04 11:07:08 +08:00
|
|
|
var path = require("path");
|
|
|
|
|
|
|
|
module.exports = {
|
2017-12-14 17:09:09 +08:00
|
|
|
// mode: "development" || "production",
|
2016-01-04 11:07:08 +08:00
|
|
|
entry: {
|
|
|
|
pageA: "./pageA",
|
|
|
|
pageB: "./pageB",
|
|
|
|
pageC: "./pageC"
|
2018-01-20 00:06:59 +08:00
|
|
|
},
|
|
|
|
optimization: {
|
2018-12-19 21:05:17 +08:00
|
|
|
chunkIds: "named",
|
2018-01-20 00:06:59 +08:00
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
2018-01-22 22:18:41 +08:00
|
|
|
commons: {
|
|
|
|
chunks: "initial",
|
|
|
|
minChunks: 2,
|
2018-02-17 20:35:06 +08:00
|
|
|
maxInitialRequests: 5, // The default limit is too small to showcase the effect
|
2018-01-22 22:18:41 +08:00
|
|
|
minSize: 0 // This is example is too small to create commons chunks
|
|
|
|
},
|
2018-01-20 00:06:59 +08:00
|
|
|
vendor: {
|
|
|
|
test: /node_modules/,
|
2018-01-22 22:18:41 +08:00
|
|
|
chunks: "initial",
|
2018-01-20 00:06:59 +08:00
|
|
|
name: "vendor",
|
2018-02-17 20:35:06 +08:00
|
|
|
priority: 10,
|
2018-01-20 00:06:59 +08:00
|
|
|
enforce: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-04 11:07:08 +08:00
|
|
|
},
|
|
|
|
output: {
|
2018-01-05 04:39:29 +08:00
|
|
|
path: path.join(__dirname, "dist"),
|
2016-01-04 11:07:08 +08:00
|
|
|
filename: "[name].js"
|
2018-01-20 00:06:59 +08:00
|
|
|
}
|
2016-01-04 11:07:08 +08:00
|
|
|
};
|