This repository was archived by the owner on Aug 25, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprerender.config.js
More file actions
63 lines (49 loc) · 1.39 KB
/
prerender.config.js
File metadata and controls
63 lines (49 loc) · 1.39 KB
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
const path = require('path');
const PrerenderSPAPlugin = require('prerender-spa-plugin');
let Renderer = PrerenderSPAPlugin.PuppeteerRenderer;
module.exports = {
staticDir: path.resolve('dist'),
outputDir: path.resolve('prerender'),
minify: {
collapseWhitespace: true
},
renderer: new Renderer({
headless: true,
maxConcurrentRoutes: 10,
renderAfterTime: 5000
}),
routes: [
'/',
'/help',
'/plans',
'/login',
'/contact',
'/register',
'/privacy-policy',
'/terms-of-service',
'/password/change',
'/articles/1/list',
'/articles/2/list',
'/articles/3/list',
'/articles/4/list',
'/articles/5/list'
],
dynamicRoutes: [{
url: process.env.VUE_APP_API_URL + '/articles/published?limit=500',
cb: (res) => {
let i, ii;
let routes = [];
for (i = 0, ii = res.data.items.length; i < ii; i++) {
(function () {
routes.push('/articles/' + res.data.items[i].slug);
})(i);
}
return routes;
}
}],
postProcess(renderedRoute) {
// Remove all js links.
renderedRoute.html = renderedRoute.html.replace(/\/js\/.*?\.js/g, '');
return renderedRoute;
}
};