diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index 88b06d8526..431adf9c92 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -146,6 +146,8 @@ const getSPARenderer = lazyCachedFunction(async () => { const spaTemplate = await import('#spa-template').then(r => r.template).catch(() => '') .then((r) => { if (spaPreloaderOutside) { + const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>` + const APP_SPA_LOADER_CLOSE_TAG = `` const appTemplate = APP_ROOT_OPEN_TAG + APP_ROOT_CLOSE_TAG const loaderTemplate = r ? APP_SPA_LOADER_OPEN_TAG + r + APP_SPA_LOADER_CLOSE_TAG : '' return appTemplate + loaderTemplate @@ -230,9 +232,6 @@ async function getIslandContext (event: H3Event): Promise { return ctx } -const APP_SPA_LOADER_OPEN_TAG = `<${appSpaLoaderTag}${propsToString(appSpaLoaderAttrs)}>` -const APP_SPA_LOADER_CLOSE_TAG = `` - const HAS_APP_TELEPORTS = !!(appTeleportTag && appTeleportAttrs.id) const APP_TELEPORT_OPEN_TAG = HAS_APP_TELEPORTS ? `<${appTeleportTag}${propsToString(appTeleportAttrs)}>` : '' const APP_TELEPORT_CLOSE_TAG = HAS_APP_TELEPORTS ? `` : ''