-
Notifications
You must be signed in to change notification settings - Fork 9
/
vue.config.js
54 lines (54 loc) · 1.5 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
44
45
46
47
48
49
50
51
52
53
54
const PrerenderSPAPlugin = require('prerender-spa-plugin')
const path = require('path')
// const env = require('./src/config/env.config')
const isProd = process.env.NODE_ENV === 'production'
module.exports = {
// publicPath: isProd ? `https://${env.cos.assetsDomain}/${env.cos.remoteBasePath}` : '/',
publicPath: '/',
chainWebpack: config => {
if (isProd) {
config.set('externals', {
vue: 'Vue',
'vue-router': 'VueRouter',
vuex: 'Vuex'
})
}
config.module
.rule('images')
.use('url-loader')
.loader('url-loader')
.tap(options => Object.assign(options, { limit: 20000 }))
if (process.env.use_analyzer) {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
if (process.env.NODE_ENV !== 'production') return
config
.plugin('prerender-spa-plugin')
.use(PrerenderSPAPlugin)
.init(Plugin => new Plugin({
staticDir: path.join(__dirname, 'dist'),
routes: [
'/',
'/friend',
'/tool',
'/tool/imageconverter'
],
renderer: new PrerenderSPAPlugin.PuppeteerRenderer({
renderAfterDocumentEvent: 'render-event',
renderAfterElementExists: '#app',
timeout: 2000,
// maxConcurrentRoutes: 1,
renderAfterTime: 5000,
headless: false
})
}))
},
css: {
sourceMap: true
},
devServer: {
disableHostCheck: true
}
}