feat(nuxt): add apps to nuxt build-time instance (#20637)

This commit is contained in:
Julien Huang 2023-05-10 00:46:03 +02:00 committed by GitHub
parent 5781cf1569
commit 018bf125ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,8 @@ import { generateApp as _generateApp, createApp } from './app'
export async function build (nuxt: Nuxt) {
const app = createApp(nuxt)
nuxt.apps.default = app
const generateApp = debounce(() => _generateApp(nuxt, app), undefined, { leading: true })
await generateApp()

View File

@ -37,7 +37,8 @@ export function createNuxt (options: NuxtOptions): Nuxt {
hook: hooks.hook,
ready: () => initNuxt(nuxt),
close: () => Promise.resolve(hooks.callHook('close', nuxt)),
vfs: {}
vfs: {},
apps: {}
}
return nuxt

View File

@ -23,6 +23,8 @@ export interface Nuxt {
server?: any
vfs: Record<string, string>
apps: Record<string, NuxtApp>
}
export interface NuxtTemplate<Options = Record<string, any>> {