-
Notifications
You must be signed in to change notification settings - Fork 2
/
vue.config.js
80 lines (77 loc) · 1.84 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path')
class ReplaceVendorsPlugin {
constructor() {}
apply(compiler) {
compiler.hooks.compilation.tap(this.constructor.name, compilation => {
compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tap(this.constructor.name, htmlPluginData => {
htmlPluginData.html = htmlPluginData.html.replace('vue.runtime.js', 'vue.runtime.min.js')
return htmlPluginData
})
})
}
}
module.exports = {
css: {
loaderOptions: {
less: {
additionalData: `@import (reference) "~src/less/Bootstrapping/Mixins";`
}
}
},
pages: {
index: 'src/pages/index/app.js',
login: 'src/pages/login/app.js',
post: 'src/pages/post/app.js',
blog: 'src/pages/blog/app.js',
home: {
entry: 'src/pages/home/app.js',
template: 'public/template.html',
title: '个人中心 · 轻语'
},
admin: {
entry: 'src/pages/admin/app.js',
template: 'public/admin.html',
title: '后台管理 · 轻语'
},
repo: {
entry: 'src/pages/repo/app.js',
template: 'public/blog.html',
title: '知识库 · 轻语'
},
},
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8101',
changeOrigin: true
},
'/upload': {
target: 'http://localhost:8101',
changeOrigin: true
},
'/admin': {
target: 'http://localhost:8101',
bypass() {
return '/admin.html'
}
}
}
},
chainWebpack: config => {
config.plugins.delete('prefetch')
},
configureWebpack: {
externals: {
vue: 'Vue'
},
resolve: {
extensions: ['*', '.js', '.vue', '.json'],
alias: {
src: path.join(__dirname, 'src')
}
},
plugins: process.env.NODE_ENV === 'production' ? [
new ReplaceVendorsPlugin()
] : []
}
}