This repository has been archived by the owner on Feb 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
82 lines (71 loc) · 1.87 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
81
82
require('dotenv').config()
const webpack = require('webpack')
const BitBarWebpackProgressPlugin = require('bitbar-webpack-progress-plugin')
const ExtractTextPlugin = require('mini-css-extract-plugin')
const buildInfo = require('./build-info')
const isEnvProduction = process.env.NODE_ENV === 'production'
const isEnvDevelopment = process.env.NODE_ENV === 'development'
// Prepare webpack plugins
const webpackPlugins = []
if (isEnvDevelopment) {
webpackPlugins.push(new BitBarWebpackProgressPlugin())
}
const build = buildInfo()
webpackPlugins.push(
new webpack.DefinePlugin({
'process.env': {
VUE_APP_BUILD: JSON.stringify(build),
VUE_APP_BRANCH: JSON.stringify(build.git.branch)
}
})
)
module.exports = {
devServer: {
overlay: {
warnings: false,
errors: true
},
proxy: {
'^/api': {
target: process.env.API_URL,
changeOrigin: true,
proxyTimeout: 5 * 60 * 1000,
onProxyReq: (proxyReq, req) => req.setTimeout(5 * 60 * 1000)
}
}
},
chainWebpack: config => {
if (isEnvProduction) {
config.plugin('workbox')
}
config.plugin('extract-css').use(ExtractTextPlugin, [
{
filename: 'css/[name].css?[hash]',
allChunks: true
}
])
},
pwa: {
name: 'CryptoCapWatch',
start_url: './index.html',
display: 'standalone',
themeColor: '#1372BA',
msTileColor: '#1372BA',
// configure the workbox plugin
workboxPluginMode: 'GenerateSW',
workboxOptions: {
skipWaiting: true,
clientsClaim: true,
navigateFallback: 'index.html',
exclude: [/.*service-worker\.js$/, /.*admin\.html$/]
}
},
configureWebpack: {
devtool: isEnvDevelopment ? 'eval-source-map' : 'source-map',
plugins: webpackPlugins,
output: {
filename: 'js/[name].js?[hash]',
chunkFilename: 'js/[name].js?[hash]'
}
}
}