-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue.config.js
More file actions
152 lines (151 loc) · 4.13 KB
/
vue.config.js
File metadata and controls
152 lines (151 loc) · 4.13 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
const webpack = require('webpack')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const helpers = require('./helpers')
const path = require('path')
const CompressionPlugin = require('compression-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
productionSourceMap: false,
chainWebpack: config => {
config.plugins.delete('prefetch')
config.plugin('CompressionPlugin').use(
new CompressionPlugin({
algorithm: 'gzip',
test: /\.(js|css)$/
})
)
},
configureWebpack: config => {
if (process.env.NODE_ENV === 'development') {
return {
mode: 'development',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true
})
],
runtimeChunk: 'single',
splitChunks: {
chunks: 'all'
}
},
resolve: {
alias: {
'@mock-api': path.resolve(__dirname, 'src/api-mock')
}
},
devServer: {
hot: false,
port: 10001
}
}
} else if (process.env.NODE_ENV === 'dev-nomock') {
return {
mode: 'development',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true
})
],
runtimeChunk: 'single',
splitChunks: {
chunks: 'all'
}
},
devServer: {
hot: false,
port: 10001,
proxy: {
'^/api': {
target: 'http://localhost:8080',
ws: true,
changeOrigin: true
},
'^/ws': {
target: 'http://localhost:8080',
changeOrigin: true,
ws: true
}
}
}
}
}
return {
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
parallel: true
})
],
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/](?!(buefy|@fortawesome|vee-validate|vue-moment|sockjs-client))(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'vendors',
enforce: true
},
buefy: {
test: /[\\/]node_modules[\\/]buefy(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'buefy',
enforce: true
},
fortawesome: {
test: /[\\/]node_modules[\\/]@fortawesome(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'fortawesome',
enforce: true
},
sockjs_client: {
test: /[\\/]node_modules[\\/]sockjs-client(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'sockjs-client',
enforce: true
},
vee_validate: {
test: /[\\/]node_modules[\\/]vee-validate(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'vee-validate',
enforce: true
},
vue_moment: {
test: /[\\/]node_modules[\\/]vue-moment(.[a-zA-Z0-9.\-_]+)[\\/]/,
chunks: 'initial',
name: 'vue-moment',
enforce: true
}
}
}
}
}
},
pwa: {
name: 'Function',
themeColor: '#02AAF3',
msTileColor: '#02AAF3',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black-translucent',
manifestOptions: {
backgroundColor: '#02AAF3'
},
iconPaths: {
favicon32: 'img/icons/favicon-32x32.png',
favicon16: 'img/icons/favicon-16x16.png',
appleTouchIcon: 'img/icons/apple-touch-icon.png',
maskIcon: 'img/icons/safari-pinned-tab.svg',
msTileImage: 'img/icons/mstile-150x150.png'
},
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: 'src/service-worker.js',
exclude: [/manifest\.json$/]
}
}
}