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
|
// @ts-expect-error virtual file
|
||||||
import RootComponent from '#build/root-component.mjs'
|
import RootComponent from '#build/root-component.mjs'
|
||||||
// @ts-expect-error virtual file
|
// @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>>
|
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 }
|
if (vueApp.config.errorHandler === handleVueError) { vueApp.config.errorHandler = undefined }
|
||||||
})
|
})
|
||||||
|
|
||||||
// Remove spa loader if present
|
if (spaPreloaderOutside && !isSSR && appSpaLoaderAttrs.id) {
|
||||||
nuxt.hook('app:suspense:resolve', () => {
|
// Remove spa loader if present
|
||||||
if (!isSSR && appSpaLoaderAttrs.id) { document.getElementById(appSpaLoaderAttrs.id)?.remove() }
|
nuxt.hook('app:suspense:resolve', () => {
|
||||||
})
|
document.getElementById(appSpaLoaderAttrs.id)?.remove()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await applyPlugins(nuxt, plugins)
|
await applyPlugins(nuxt, plugins)
|
||||||
|
Loading…
Reference in New Issue
Block a user