-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
46 lines (44 loc) · 1.34 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const path = require("path")
const webpack = require("webpack")
const ChunkManifestPlugin = require("chunk-manifest-webpack-plugin")
const minChunks = function(module) {
return module.context && module.context.indexOf("vendor") !== -1;
}
module.exports = function(env) {
return {
entry: {
"site": "./src/site",
"admin": "./src/admin"
},
output: {
filename: "[chunkhash]/[name].js",
publicPath: "/dist/",
path: path.resolve(__dirname, "dist")
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "common",
chunks: ["site", "admin"]
}),
new webpack.optimize.CommonsChunkPlugin({
name: "common-vendor",
chunks: ["common"],
minChunks
}),
new webpack.optimize.CommonsChunkPlugin({
name: "site-vendor",
chunks: ["site"],
minChunks
}),
new webpack.optimize.CommonsChunkPlugin({
name: "admin-vendor",
chunks: ["admin"],
minChunks
}),
new webpack.optimize.CommonsChunkPlugin({
name: "manifest",
minChunks: Infinity
})
]
}
}