在 main.js文件
prerender-spa-plugin
const PrerenderSPAPlugin = require('prerender-spa-plugin')
if (envLowerCase !== 'dev') {
webpackConfig.plugins.push(new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.
staticDir: path.resolve(
__dirname,
'../OUTPUT/' + envLowerCase.toUpperCase()
),
// Required - Routes to render.
routes: ['/', '/customer-management', '/customer-create', '/customer-overview', '/customer-edit', '/customer-detail' ,'/customer-overview',
'/redemption-register-list', '/redemption-flow-list', '/redemption-list'],
// minify: {
// collapseBooleanAttributes: true,
// collapseWhitespace: true,
// decodeEntities: true,
// keepClosingSlash: true,
// sortAttributes: true
// },
postProcessHtml: function (context) {
var html = context.html
html = html.replace(/<base href=\"http:\/\/localhost:8000\/[A-Za-z\-]+\">/, '')
return html
},
renderer: new PrerenderSPAPlugin.PuppeteerRenderer({
headless: true,
renderAfterDocumentEvent: 'render-event'
})
}));
}
网友评论