mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-22 11:22:43 +00:00
perf: tree-shake spa loader handling
This commit is contained in:
parent
86db10ea88
commit
84d1bcb5fe
@ -17,7 +17,7 @@ import plugins from '#build/plugins'
|
||||
// @ts-expect-error virtual file
|
||||
import RootComponent from '#build/root-component.mjs'
|
||||
// @ts-expect-error virtual file
|
||||
import { appId, appSpaLoaderAttrs, multiApp, vueAppRootContainer } from '#build/nuxt.config.mjs'
|
||||
import { appId, appSpaLoaderAttrs, multiApp, spaPreloaderOutside, vueAppRootContainer } from '#build/nuxt.config.mjs'
|
||||
|
||||
let entry: (ssrContext?: CreateOptions['ssrContext']) => Promise<App<Element>>
|
||||
|
||||
@ -72,10 +72,12 @@ if (import.meta.client) {
|
||||
if (vueApp.config.errorHandler === handleVueError) { vueApp.config.errorHandler = undefined }
|
||||
})
|
||||
|
||||
// Remove spa loader if present
|
||||
nuxt.hook('app:suspense:resolve', () => {
|
||||
if (!isSSR && appSpaLoaderAttrs.id) { document.getElementById(appSpaLoaderAttrs.id)?.remove() }
|
||||
})
|
||||
if (spaPreloaderOutside && !isSSR && appSpaLoaderAttrs.id) {
|
||||
// Remove spa loader if present
|
||||
nuxt.hook('app:suspense:resolve', () => {
|
||||
document.getElementById(appSpaLoaderAttrs.id)?.remove()
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
await applyPlugins(nuxt, plugins)
|
||||
|
Loading…
Reference in New Issue
Block a user