-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
58 lines (56 loc) · 1.66 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
const path = require('path');
const PrerenderSPAPlugin = require('prerender-spa-plugin');
const Renderer = PrerenderSPAPlugin.PuppeteerRenderer;
const renderRoutes = (() => {
const routes = [
'/', '/about', '/rooms', '/reservation', '/transportation', '/tourism',
].map((route) => route.replace(/\/$/, ''))
routes.push(...routes.map((route) => `${route}/`))
return routes
})()
module.exports = {
publicPath: '/',
configureWebpack: (config) => {
config.optimization = {
splitChunks: {
minSize: 10000,
maxSize: 200000,
}
}
config.performance = {
maxAssetSize: 300000,
maxEntrypointSize: 500000,
}
if (process.env.NODE_ENV === 'production') {
config.plugins.push(
new PrerenderSPAPlugin({
useRenderEvent: true,
onlyProduction: true,
registry: undefined,
staticDir: path.join(__dirname, 'dist'),
routes: renderRoutes,
postProcess(renderedRoute) {
renderedRoute.route = renderedRoute.originalRoute
if (renderedRoute.route.endsWith('.html')) {
renderedRoute.outputPath = path.join(__dirname, 'dist', renderedRoute.route)
}
return renderedRoute
},
renderer: new Renderer({
renderAfterDocumentEvent: 'render-event',
headless: true,
}),
minify: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
decodeEntities: true,
keepClosingSlash: true,
sortAttributes: true,
minifyCSS: true,
minifyJS: true
}
})
);
}
}
}