-
Notifications
You must be signed in to change notification settings - Fork 7
/
vue.config.js
34 lines (30 loc) · 1010 Bytes
/
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
module.exports = {publicPath: ''};
const path = require('path')
const PrerenderSpaPlugin = require('prerender-spa-plugin')
const Renderer = PrerenderSpaPlugin.PuppeteerRenderer
module.exports = {
publicPath: '',
configureWebpack: config => {
if (process.env.NODE_ENV !== 'production') {
return;
}
return {
plugins: [
new PrerenderSpaPlugin({
// Absolute path to compiled SPA
staticDir: path.resolve(__dirname, 'dist'),
// List of routes to prerender
routes: ['/'],
renderer: new Renderer({
renderAfterDocumentEvent: 'prerender-ready',
}),
postProcess(renderedRoute) {
// Tell Vue to treat page as an already-rendered app and update it rather than completely rerendering the whole tree
renderedRoute.html = renderedRoute.html.replace('id="app"', 'id="app" data-server-rendered="true"');
return renderedRoute
},
}),
]
}
}
}