diff --git a/packages/nuxt/src/app/entry.ts b/packages/nuxt/src/app/entry.ts index 2bd8722438..dd4f4ab97a 100644 --- a/packages/nuxt/src/app/entry.ts +++ b/packages/nuxt/src/app/entry.ts @@ -1,4 +1,5 @@ import { createApp, createSSRApp, nextTick } from 'vue' +import type { App } from 'vue' // These files must be imported first as they have side effects: // 1. (we set __webpack_public_path via this import, if using webpack builder) @@ -17,7 +18,7 @@ import RootComponent from '#build/root-component.mjs' // @ts-expect-error virtual file import { vueAppRootContainer } from '#build/nuxt.config.mjs' -let entry: Function +let entry: (ssrContext?: CreateOptions['ssrContext']) => Promise> if (import.meta.server) { entry = async function createNuxtAppServer (ssrContext: CreateOptions['ssrContext']) { @@ -46,7 +47,7 @@ if (import.meta.client) { } // eslint-disable-next-line - let vueAppPromise: Promise + let vueAppPromise: Promise> entry = async function initApp () { if (vueAppPromise) { return vueAppPromise } @@ -90,7 +91,8 @@ if (import.meta.client) { vueAppPromise = entry().catch((error: unknown) => { console.error('Error while mounting app:', error) + throw error }) } -export default (ctx?: CreateOptions['ssrContext']) => entry(ctx) +export default (ssrContext?: CreateOptions['ssrContext']) => entry(ssrContext)