-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathvue.config.js
43 lines (39 loc) · 1.02 KB
/
vue.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
const merge = require('lodash.merge')
const nodeExternals = require('webpack-node-externals')
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
const TARGET_NODE = process.env.WEBPACK_TARGET === 'node'
const serverConfig = {
entry: './src/entry.server.js',
target: 'node',
devtool: 'source-map',
output: {
libraryTarget: 'commonjs2'
},
optimization: {
splitChunks: false
},
externals: nodeExternals({
whitelist: /\.css$/
}),
plugins: [
new VueSSRServerPlugin()
]
}
const clientConfig = {
entry: './src/entry.client.js',
optimization: {
splitChunks: {
minChunks: Infinity
}
},
plugins: [
new VueSSRClientPlugin()
]
}
module.exports = {
configureWebpack: () => TARGET_NODE ? serverConfig : clientConfig,
chainWebpack: config => config.module.rule('vue').use('vue-loader')
.tap(options => merge(options, { optimizeSSR: false })),
devServer: { proxy: 'http://localhost:8081' }
}