You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
|
4 years ago
|
const path = require("path");
|
||
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
entry: {
|
||
|
|
entry1: "./src/entry/entry1.js",
|
||
|
|
entry2: "./src/entry/entry2.js",
|
||
|
|
},
|
||
|
|
plugins: [new CleanWebpackPlugin()],
|
||
|
|
output: {
|
||
|
|
filename: "[name].bundle.js",
|
||
|
|
path: path.resolve(__dirname, "dist"),
|
||
|
|
},
|
||
|
|
optimization: {
|
||
|
|
splitChunks: {
|
||
|
|
chunks: "initial",
|
||
|
|
minSize: 1,
|
||
|
|
maxSize: 0,
|
||
|
|
cacheGroups: {
|
||
|
|
vendors: {
|
||
|
|
test: /[\\/]node_modules[\\/]/,
|
||
|
|
priority: -10,
|
||
|
|
},
|
||
|
|
default: {
|
||
|
|
minChunks: 1,
|
||
|
|
priority: -20,
|
||
|
|
reuseExistingChunk: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
// default config
|
||
|
|
// optimization: {
|
||
|
|
// splitChunks: {
|
||
|
|
// chunks: 'async',
|
||
|
|
// minSize: 30000,
|
||
|
|
// minChunks: 1,
|
||
|
|
// maxAsyncRequests: 5,
|
||
|
|
// maxInitialRequests: 3,
|
||
|
|
// automaticNameDelimiter: '~',
|
||
|
|
// automaticNameMaxLength: 30,
|
||
|
|
// name: true,
|
||
|
|
// cacheGroups: {
|
||
|
|
// vendors: {
|
||
|
|
// test: /[\\/]node_modules[\\/]/,
|
||
|
|
// priority: -10
|
||
|
|
// },
|
||
|
|
// default: {
|
||
|
|
// minChunks: 2,
|
||
|
|
// priority: -20,
|
||
|
|
// reuseExistingChunk: true
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
};
|