优化PrerenderSPAPlugin配置

This commit is contained in:
cebgcontract 2022-02-28 11:29:19 +08:00
parent eff248a404
commit 58c3669287
4 changed files with 29 additions and 24 deletions

View File

@ -16,5 +16,9 @@ Vue.config.productionTip = false
new Vue({
router,
store,
render: (h) => h(App)
render: (h) => h(App),
mounted() {
// You'll need this for renderAfterDocumentEvent.
document.dispatchEvent(new Event('render-event'))
}
}).$mount('#app')

View File

@ -30,12 +30,8 @@ const routes: Array<RouteConfig> = [
{
path: '/',
name: 'Main',
component: mobile ? MobileIndex : Index
},
{
path: '/index.html',
name: 'Main1',
component: mobile ? MobileIndex : Index
component: mobile ? MobileIndex : Index,
alias: '/index.html'
},
{
path: '/market',
@ -68,27 +64,32 @@ const routes: Array<RouteConfig> = [
{
path: '/nft',
name: 'Nft',
component: mobile ? MobileNft : NFT
component: mobile ? MobileNft : NFT,
alias: '/nft/index.html'
},
{
path: '/gameplay',
name: 'Gameplay',
component: mobile ? MobileGameplay : Gameplay
component: mobile ? MobileGameplay : Gameplay,
alias: '/gameplay/index.html'
},
{
path: '/tokenomic',
name: 'Tokenomic',
component: mobile ? MobileTokennomic : Tokenomic
component: mobile ? MobileTokennomic : Tokenomic,
alias: '/tokenomic/index.html'
},
{
path: '/team',
name: 'Team',
component: mobile ? MobileTeam : Team
component: mobile ? MobileTeam : Team,
alias: '/team/index.html'
},
{
path: '/roadmap',
name: 'Roadmap',
component: mobile ? MobileRoadmap : Roadmap
component: mobile ? MobileRoadmap : Roadmap,
alias: '/roadmap/index.html'
}
]

View File

@ -1,5 +1,5 @@
<template>
<div class="container" :style="cstyle">
<div class="container">
<mobile-header current-section="roadmap"></mobile-header>
<div class="content">
<div class="title-bar">

View File

@ -32,16 +32,16 @@ module.exports = {
args[0].title = 'CEBG: CRYPTO ELITES BATTLEGROUNDS'
return args
})
},
configureWebpack(config) {
if (process.env.NODE_ENV === 'production') {
config.plugins.push(
new PrerenderSPAPlugin({
indexPath: path.resolve('dist/index.html'),
staticDir: path.resolve('dist'),
routes: ['/nft', '/gameplay', '/tokenomic', '/roadmap', '/team']
})
)
}
}
// configureWebpack(config) {
// if (process.env.NODE_ENV === 'production') {
// config.plugins.push(
// new PrerenderSPAPlugin({
// indexPath: path.resolve('dist/index.html'),
// staticDir: path.resolve('dist'),
// routes: ['/nft', '/gameplay', '/tokenomic']
// })
// )
// }
// }
}