fix(generator): keep generating pages in SPA (#7400)

* fix(generator): keep generating pages in SPA

* chore: fix lint error

Co-authored-by: pooya parsa <pooya@pi0.ir>
This commit is contained in:
Sébastien Chopin 2020-05-20 17:55:54 +02:00 committed by GitHub
parent 0bdc71c8d8
commit 60ae0fb011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import fsExtra from 'fs-extra'
import htmlMinifier from 'html-minifier' import htmlMinifier from 'html-minifier'
import { parse } from 'node-html-parser' import { parse } from 'node-html-parser'
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS, MODES } from '@nuxt/utils' import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS } from '@nuxt/utils'
export default class Generator { export default class Generator {
constructor (nuxt, builder) { constructor (nuxt, builder) {
@ -92,7 +92,7 @@ export default class Generator {
async initRoutes (...args) { async initRoutes (...args) {
// Resolve config.generate.routes promises before generating the routes // Resolve config.generate.routes promises before generating the routes
let generateRoutes = [] let generateRoutes = []
if (this.options.mode === MODES.universal && this.options.router.mode !== 'hash') { if (this.options.router.mode !== 'hash') {
try { try {
generateRoutes = await promisifyRoute( generateRoutes = await promisifyRoute(
this.options.generate.routes || [], this.options.generate.routes || [],
@ -105,7 +105,7 @@ export default class Generator {
} }
let routes = [] let routes = []
// Generate only index.html for router.mode = 'hash' or client-side apps // Generate only index.html for router.mode = 'hash' or client-side apps
if (this.options.mode === MODES.spa || this.options.router.mode === 'hash') { if (this.options.router.mode === 'hash') {
routes = ['/'] routes = ['/']
} else { } else {
routes = flatRoutes(this.getAppRoutes()) routes = flatRoutes(this.getAppRoutes())