You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
const webpack = require("webpack");
|
|
const { merge } = require("webpack-merge");
|
|
const base = require("./webpack.base.config");
|
|
const { isProd } = require("./util");
|
|
const VueSSRClientPlugin = require("vue-server-renderer/client-plugin");
|
|
|
|
const allConfig = merge(base, {
|
|
mode: process.env.NODE_ENV || "development",
|
|
entry: {
|
|
app: "./src/entry-client.js",
|
|
},
|
|
plugins: [
|
|
// strip dev-only code in Vue source
|
|
new webpack.DefinePlugin({
|
|
"process.env.NODE_ENV": JSON.stringify(
|
|
process.env.NODE_ENV || "development"
|
|
),
|
|
"process.env.VUE_ENV": '"client"',
|
|
}),
|
|
new VueSSRClientPlugin(),
|
|
],
|
|
|
|
optimization: {
|
|
splitChunks: {
|
|
chunks: "all",
|
|
minChunks: 1,
|
|
name: "manifest",
|
|
cacheGroups: {
|
|
vendors: {
|
|
name: "vendors",
|
|
test: /[\\/]node_modules[\\/]/,
|
|
chunks: "all",
|
|
minSize: 0,
|
|
minChunks: 2, //有两次引用以上才提取
|
|
priority: 3, //比上面更低的权重
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
module.exports = allConfig;
|
|
|