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

View File

@ -5,7 +5,7 @@ import fsExtra from 'fs-extra'
import htmlMinifier from 'html-minifier'
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 {
constructor (nuxt, builder) {
@ -92,7 +92,7 @@ export default class Generator {
async initRoutes (...args) {
// Resolve config.generate.routes promises before generating the routes
let generateRoutes = []
if (this.options.mode === MODES.universal && this.options.router.mode !== 'hash') {
if (this.options.router.mode !== 'hash') {
try {
generateRoutes = await promisifyRoute(
this.options.generate.routes || [],
@ -105,7 +105,7 @@ export default class Generator {
}
let routes = []
// 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 = ['/']
} else {
routes = flatRoutes(this.getAppRoutes())