mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-20 15:41:11 +00:00
generate only index.html when router.mode = 'hash'
This commit is contained in:
parent
d3f707dde2
commit
2ff304898d
@ -69,24 +69,29 @@ export default async function () {
|
|||||||
}
|
}
|
||||||
await copy(srcBuiltPath, distNuxtPath)
|
await copy(srcBuiltPath, distNuxtPath)
|
||||||
debug('Static & build files copied')
|
debug('Static & build files copied')
|
||||||
|
if (this.options.router !== 'hash') {
|
||||||
// Resolve config.generate.routes promises before generating the routes
|
// Resolve config.generate.routes promises before generating the routes
|
||||||
try {
|
try {
|
||||||
var generateRoutes = await promisifyRoute(this.options.generate.routes || [])
|
var generateRoutes = await promisifyRoute(this.options.generate.routes || [])
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Could not resolve routes') // eslint-disable-line no-console
|
console.error('Could not resolve routes') // eslint-disable-line no-console
|
||||||
console.error(e) // eslint-disable-line no-console
|
console.error(e) // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
throw e // eslint-disable-line no-unreachable
|
throw e // eslint-disable-line no-unreachable
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
** Generate html files from routes
|
||||||
|
*/
|
||||||
|
generateRoutes.forEach((route) => {
|
||||||
|
if (this.routes.indexOf(route) < 0) {
|
||||||
|
this.routes.push(route)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** Generate html files from routes
|
** Generate only index.html for router.mode = 'hash'
|
||||||
*/
|
*/
|
||||||
generateRoutes.forEach((route) => {
|
let routes = (this.options.router === 'hash') ? ['/'] : this.routes
|
||||||
if (this.routes.indexOf(route) < 0) {
|
|
||||||
this.routes.push(route)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let routes = this.routes
|
|
||||||
while (routes.length) {
|
while (routes.length) {
|
||||||
let n = 0
|
let n = 0
|
||||||
await Promise.all(routes.splice(0, 500).map(async (route) => {
|
await Promise.all(routes.splice(0, 500).map(async (route) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user