-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvue.config.js
36 lines (33 loc) · 1.15 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
const merge = require('webpack-merge');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin');
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin');
const isServer = process.env.WEBPACK_TARGET === 'node';
module.exports = {
outputDir: path.join(__dirname, isServer ? './.bundle' : './dist'),
configureWebpack: () => ({
entry: `./src/entry-${ isServer ? 'server' : 'client' }.js`,
target: isServer ? 'node' : 'web',
node: isServer ? undefined : false,
devtool: 'source-map',
plugins: [
isServer ? new VueSSRServerPlugin() : new VueSSRClientPlugin()
],
externals: isServer ? nodeExternals({ whitelist: /\.css$/ }) : undefined,
output: {
libraryTarget: isServer ? 'commonjs2' : undefined
}
}),
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
merge(options, {
optimizeSSR: false
})
})
},
productionSourceMap: false,
}