-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvue.config.js
35 lines (31 loc) · 1.03 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
module.exports = {publicPath: ''};
const path = require('path')
const PrerendererWebpackPlugin = require('@prerenderer/webpack-plugin');
module.exports = {
publicPath: '',
configureWebpack: config => {
if (process.env.NODE_ENV !== 'production') {
return;
}
return {
plugins: [
new PrerendererWebpackPlugin({
// Absolute path to compiled SPA
staticDir: path.resolve(__dirname, 'dist'),
// List of routes to prerender
routes: ['/'],
renderer: '@prerenderer/renderer-puppeteer',
rendererOptions: {
renderAfterDocumentEvent: 'prerender-ready',
headless: true,
},
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
},
}),
]
}
}
}