[prerender-spa-plugin] Unable to prerender all routes!
See original GitHub issueI think prerender-spa-plugin is very good I tried to use it on my website, but the local build succeeded, but the build on jenkins failed
- Building for buildUat… Browserslist: caniuse-lite is outdated. Please run next command
npm update
[prerender-spa-plugin] Unable to prerender all routes! ERROR Failed to compile with 1 errors12:29:37 AM
error
[prerender-spa-plugin] Unable to prerender all routes!
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! proj-hyt-web@0.1.0 build:uat: vue-cli-service build --mode buildUat
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the proj-hyt-web@0.1.0 build:uat script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-02-18T00_29_37_088Z-debug.log Build step ‘Execute shell’ marked build as failure Finished: FAILURE
My configuration information:
` vue.config.js–> const path = require(‘path’) const PrerenderSPAPlugin = require(‘prerender-spa-plugin’); const Renderer = PrerenderSPAPlugin.PuppeteerRenderer
module.exports = {
publicPath: ‘/’,
// assetsDir: ‘./cn’,
configureWebpack: {
resolve: {
symlinks: false,
alias: {
// Make sure our version of ag-grid & vue is always loaded.
// This is needed for yarn link / npm link
to work and prevent duplicate versions of these libs
// being loaded
‘ag-grid-community/main’: path.resolve(__dirname, ‘node_modules/ag-grid-community/main.js’),
‘ag-grid-community$’: path.resolve(__dirname, ‘node_modules/ag-grid-community/main.js’),
vue$: path.resolve(__dirname, ‘node_modules/vue/dist/vue.common.js’),
assets: path.resolve(__dirname, ‘src/assets/’),
components: path.resolve(__dirname, ‘src/components/’),
utils: path.resolve(__dirname, ‘src/utils/’),
jquery: path.resolve(__dirname, ‘node_modules/jquery/dist/jquery.min.js’),
}
},
performance: {
hints: false
},
plugins: [
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, ‘dist’),
routes: [‘/index/home’],
postProcess(renderedRoute) {
renderedRoute.html = renderedRoute.html
.replace(/<script (.*?)>/g, <script $1 defer>
)
.replace(id="app"
, id="app" data-server-rendered="true"
)
return renderedRoute
},
renderer: new Renderer({
inject: {},
headless: true,
renderAfterElementExists: `[data-view]`
})
})
]
}
}
router.js —> import Vue from ‘vue’ import Router from ‘vue-router’ import Index from ‘./views/index/index.vue’ import Home from ‘./views/index/home.vue’
Vue.use(Router)
export default new Router({ mode: ‘history’, routes: [ { path: ‘/’, redirect: ‘/index/home’ }, { path: ‘/index’, component: Index, children: [ { path: ‘home’, component: Home, }… `
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top GitHub Comments
Try changing PuppeteerRenderer
maxConcurrentRoutes
settings, check readme for example.