mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
refactor(nuxt): explicitly import app in nuxt-root (#8729)
This commit is contained in:
parent
453ce78300
commit
3839dba06a
@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<Suspense @resolve="onResolve">
|
||||
<ErrorComponent v-if="error" :error="error" />
|
||||
<App v-else />
|
||||
<AppComponent v-else />
|
||||
</Suspense>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineAsyncComponent, onErrorCaptured, provide } from 'vue'
|
||||
import { callWithNuxt, isNuxtError, showError, useError, useRoute, useNuxtApp } from '#app'
|
||||
import AppComponent from '#build/app-component.mjs'
|
||||
|
||||
const ErrorComponent = defineAsyncComponent(() => import('#build/error-component.mjs').then(r => r.default || r))
|
||||
|
||||
|
@ -9,8 +9,6 @@ import '#build/css'
|
||||
import _plugins from '#build/plugins'
|
||||
// @ts-ignore
|
||||
import RootComponent from '#build/root-component.mjs'
|
||||
// @ts-ignore
|
||||
import AppComponent from '#build/app-component.mjs'
|
||||
|
||||
if (!globalThis.$fetch) {
|
||||
// @ts-ignore
|
||||
@ -26,7 +24,6 @@ const plugins = normalizePlugins(_plugins)
|
||||
if (process.server) {
|
||||
entry = async function createNuxtAppServer (ssrContext: CreateOptions['ssrContext']) {
|
||||
const vueApp = createApp(RootComponent)
|
||||
vueApp.component('App', AppComponent)
|
||||
|
||||
const nuxt = createNuxtApp({ vueApp, ssrContext })
|
||||
|
||||
@ -54,7 +51,6 @@ if (process.client) {
|
||||
entry = async function initApp () {
|
||||
const isSSR = Boolean(window.__NUXT__?.serverRendered)
|
||||
const vueApp = isSSR ? createSSRApp(RootComponent) : createApp(RootComponent)
|
||||
vueApp.component('App', AppComponent)
|
||||
|
||||
const nuxt = createNuxtApp({ vueApp })
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user