mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
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:
parent
0bdc71c8d8
commit
60ae0fb011
@ -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())
|
||||||
|
Loading…
Reference in New Issue
Block a user