Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
refactor(nuxt): explicitly import app in nuxt-root (#8729)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 9, 2022
1 parent 453ce78 commit 3839dba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/nuxt/src/app/components/nuxt-root.vue
@@ -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))
Expand Down
4 changes: 0 additions & 4 deletions packages/nuxt/src/app/entry.ts
Expand Up @@ -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
Expand All @@ -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 })

Expand Down Expand Up @@ -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 })

Expand Down

0 comments on commit 3839dba

Please sign in to comment.