Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/nuxt/src/core/builder.ts
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion packages/nuxt/src/core/nuxt.ts
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/schema/src/types/nuxt.ts
Expand Up @@ -23,6 +23,8 @@ export interface Nuxt {
server?: any

vfs: Record<string, string>

apps: Record<string, NuxtApp>
}

export interface NuxtTemplate<Options = Record<string, any>> {
Expand Down