Nuxt · Architecture
NUXT0076Keep types shared by app and server in shared/types
Report type-only imports from the Nuxt server directory in app or shared code.
vite-doctor/nuxtarchitectureinfoSuggestion
Why it happens
Type-only imports are erased from the client bundle, but they couple app code to server internals. A refactor that adds a runtime import next to the type pulls server code into the client. Types used by both sides belong in shared/types/, which Nuxt auto-imports in both the app and the server.
Fix
Move types used by both the app and the server to shared/types/ and import them from there on both sides.
Example
Share types through shared/types
Before
// app/pages/orders.vue <script setup>
import type { Order } from '~~/server/utils/orders'
After
// shared/types/order.ts
export interface Order {
id: string
totalCents: number
}
// app/pages/orders.vue: auto-imported
const { data } = await useFetch<Order[]>('/api/orders')
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm nuxt doctor --extends auto,nuxt/strict --rules nuxt/structure/no-server-types-in-app