(id?: string)
| 576 | */ |
| 577 | export function useNuxtApp (): NuxtApp |
| 578 | export function useNuxtApp (id?: string): NuxtApp { |
| 579 | // @ts-expect-error internal usage of id |
| 580 | const nuxtAppInstance = tryUseNuxtApp(id) |
| 581 | |
| 582 | if (!nuxtAppInstance) { |
| 583 | if (import.meta.dev) { |
| 584 | throw new Error('[nuxt] A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function. This is probably not a Nuxt bug. Find out more at `https://nuxt.com/docs/4.x/guide/concepts/auto-imports#vue-and-nuxt-composables`.') |
| 585 | } else { |
| 586 | throw new Error('[nuxt] instance unavailable') |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | return nuxtAppInstance |
| 591 | } |
| 592 | |
| 593 | /** @since 3.0.0 */ |
| 594 | /* @__NO_SIDE_EFFECTS__ */ |
searching dependent graphs…