mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
feat(nuxt): add apps to nuxt build-time instance (#20637)
This commit is contained in:
parent
5781cf1569
commit
018bf125ab
@ -11,6 +11,8 @@ import { generateApp as _generateApp, createApp } from './app'
|
|||||||
|
|
||||||
export async function build (nuxt: Nuxt) {
|
export async function build (nuxt: Nuxt) {
|
||||||
const app = createApp(nuxt)
|
const app = createApp(nuxt)
|
||||||
|
nuxt.apps.default = app
|
||||||
|
|
||||||
const generateApp = debounce(() => _generateApp(nuxt, app), undefined, { leading: true })
|
const generateApp = debounce(() => _generateApp(nuxt, app), undefined, { leading: true })
|
||||||
await generateApp()
|
await generateApp()
|
||||||
|
|
||||||
|
@ -37,7 +37,8 @@ export function createNuxt (options: NuxtOptions): Nuxt {
|
|||||||
hook: hooks.hook,
|
hook: hooks.hook,
|
||||||
ready: () => initNuxt(nuxt),
|
ready: () => initNuxt(nuxt),
|
||||||
close: () => Promise.resolve(hooks.callHook('close', nuxt)),
|
close: () => Promise.resolve(hooks.callHook('close', nuxt)),
|
||||||
vfs: {}
|
vfs: {},
|
||||||
|
apps: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nuxt
|
return nuxt
|
||||||
|
@ -23,6 +23,8 @@ export interface Nuxt {
|
|||||||
server?: any
|
server?: any
|
||||||
|
|
||||||
vfs: Record<string, string>
|
vfs: Record<string, string>
|
||||||
|
|
||||||
|
apps: Record<string, NuxtApp>
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NuxtTemplate<Options = Record<string, any>> {
|
export interface NuxtTemplate<Options = Record<string, any>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user