feat: add exclude regex array for generated pages (#4754)

This commit is contained in:
Alexander Lichter 2019-01-16 17:43:56 +00:00 committed by Pooya Parsa
parent 5f6361f6db
commit ec17804c48
2 changed files with 5 additions and 1 deletions

View File

@ -55,6 +55,7 @@ export default () => ({
generate: {
dir: 'dist',
routes: [],
exclude: [],
concurrency: 500,
interval: 0,
subFolders: true,

View File

@ -4,7 +4,7 @@ import consola from 'consola'
import fsExtra from 'fs-extra'
import htmlMinifier from 'html-minifier'
import { flatRoutes, isUrl, promisifyRoute, waitFor, isString } from '@nuxt/utils'
import { flatRoutes, isString, isUrl, promisifyRoute, waitFor } from '@nuxt/utils'
export default class Generator {
constructor(nuxt, builder) {
@ -83,6 +83,9 @@ export default class Generator {
this.options.router.mode === 'hash'
? ['/']
: flatRoutes(this.options.router.routes)
routes = routes.filter(route => this.options.generate.exclude.every(regex => !regex.test(route)))
routes = this.decorateWithPayloads(routes, generateRoutes)
// extendRoutes hook