-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
89 lines (86 loc) · 2.42 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
83
84
85
86
87
88
89
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin
const path = require('path')
const PrerenderSPAPlugin = require('prerender-spa-plugin')
const CIUDADES = require('./src/ciudades.json')
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
const production = process.env.NODE_ENV === 'production'
const BASE_URL = process.env.BASE_URL ? process.env.BASE_URL : '/mapa/'
const developmentPlugins = [new VuetifyLoaderPlugin()]
const productionPlugins = [
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, 'dist'),
indexPath: path.join(__dirname, 'dist', BASE_URL, 'index.html'),
routes: [BASE_URL].concat(CIUDADES.map(c => BASE_URL + c.slug)),
}),
// bundle analyzer
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
openAnalyzer: true,
}),
new VuetifyLoaderPlugin(),
]
module.exports = {
publicPath: BASE_URL,
outputDir: 'dist' + BASE_URL,
devServer: {
public: '0.0.0.0:' + process.env.HOST_PORT || '8080',
// https: process.env.TRAVIS_HTTPS !== 'False',
},
chainWebpack: config => {
config.plugin('prefetch').tap(options => {
options[0].include = 'allAssets'
options[0].as = function(entry) {
if (/\.css$/.test(entry)) return 'style'
if (/\.woff$/.test(entry)) return 'font'
if (/\.png$/.test(entry)) return 'image'
return 'script'
}
return options
})
config.module
.rule('images')
.test(/\.(png|jpe?g|gif|webp)(\?.*)?$/)
.use('url-loader')
.loader('url-loader')
.options({
limit: 128,
name: 'img/[name].[hash:8].[ext]',
})
},
configureWebpack: {
plugins: production ? productionPlugins : developmentPlugins,
},
lintOnSave: false,
css: {
loaderOptions: {
sass: {
options: {
implementation: require('sass'),
// fiber: require('fibers'),
},
},
},
},
pwa: {
name: 'Cualbondi',
themeColor: '#4285F4',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black',
workboxOptions: {
runtimeCaching: [
{
// handler: 'staleWhileRevalidate',
handler: 'NetworkFirst',
urlPattern: new RegExp('^https://cualbondi.com.ar'),
},
{
handler: 'NetworkOnly',
urlPattern: new RegExp('.*'),
},
],
skipWaiting: true,
},
},
}