mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxt): pass nuxt
instance to resolvePagesRoutes
This commit is contained in:
parent
8e2ca5bdc2
commit
e4a372e12c
@ -75,7 +75,7 @@ export default defineNuxtModule({
|
||||
return true
|
||||
}
|
||||
|
||||
const pages = await resolvePagesRoutes()
|
||||
const pages = await resolvePagesRoutes(nuxt)
|
||||
if (pages.length) {
|
||||
if (nuxt.apps.default) {
|
||||
nuxt.apps.default.pages = pages
|
||||
@ -93,7 +93,7 @@ export default defineNuxtModule({
|
||||
}
|
||||
|
||||
nuxt.hook('app:templates', async (app) => {
|
||||
app.pages = await resolvePagesRoutes()
|
||||
app.pages = await resolvePagesRoutes(nuxt)
|
||||
|
||||
if (!nuxt.options.ssr && app.pages.some(p => p.mode === 'server')) {
|
||||
logger.warn('Using server pages with `ssr: false` is not supported with auto-detected component islands. Set `experimental.componentIslands` to `true`.')
|
||||
@ -173,7 +173,7 @@ export default defineNuxtModule({
|
||||
logs: nuxt.options.debug,
|
||||
async beforeWriteFiles (rootPage) {
|
||||
rootPage.children.forEach(child => child.delete())
|
||||
const pages = nuxt.apps.default?.pages || await resolvePagesRoutes()
|
||||
const pages = nuxt.apps.default?.pages || await resolvePagesRoutes(nuxt)
|
||||
if (nuxt.apps.default) {
|
||||
nuxt.apps.default.pages = pages
|
||||
}
|
||||
|
@ -42,9 +42,7 @@ interface ScannedFile {
|
||||
absolutePath: string
|
||||
}
|
||||
|
||||
export async function resolvePagesRoutes (): Promise<NuxtPage[]> {
|
||||
const nuxt = useNuxt()
|
||||
|
||||
export async function resolvePagesRoutes (nuxt = useNuxt()): Promise<NuxtPage[]> {
|
||||
const pagesDirs = nuxt.options._layers.map(
|
||||
layer => resolve(layer.config.srcDir, (layer.config.rootDir === nuxt.options.rootDir ? nuxt.options : layer.config).dir?.pages || 'pages'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user