-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
70 lines (62 loc) · 1.64 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
const path = require('path')
const webpack = require('webpack')
const currentVersion = require('./package.json').version
const PrerenderSPAPlugin = require('prerender-spa-plugin')
module.exports = {
css: {
loaderOptions: {
// import sass file in every component
sass: {
data: `
@import "@/assets/scss/app.scss";
`
}
}
},
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
// Get the current version in package.json file
'process.env': {
VERSION: `"${currentVersion}"`
}
}),
]
},
chainWebpack: config => {
if (process.env.NODE_ENV === 'production') {
// mutate config for production
config
.plugin('pre-render-spa')
.use(PrerenderSPAPlugin, [{
staticDir: path.join(__dirname, 'dist'),
routes: [ '/', '/calculator', '/faq' ]
}])
}
},
pwa: {
// fixes theme-color in @vue/cli pwa
themeColor: '#FF9800',
// Set current version
assetsVersion: currentVersion,
// configure workbox plugin
workboxOptions: {
skipWaiting: true,
// To match cross-origin requests, use a RegExp that matches
// the start of the origin:
runtimeCaching: [{
urlPattern: new RegExp('^https://www\.tax-ph\.com'),
handler: 'staleWhileRevalidate',
options: {
// Use a custom cache name for this route.
cacheName: 'tax-ph',
// Configure custom cache expiration.
expiration: {
maxEntries: 60,
maxAgeSeconds: /* 30 Days */ 30 * 24 * 60 * 60,
},
},
}]
},
},
}