Nuxt · NUXT0096

Import across Nuxt directories through an alias

Flags imports that climb two or more directories in app/, server/ or shared/.
NUXT0096vite-doctor/nuxtimportswarnSuggestion

Run this rule

pnpm nuxt doctor --rules nuxt/imports/prefer-alias-over-relative-parent

Why it matters

A chain of ../ breaks when a file moves and hides which part of the app it reaches into. Nuxt aliases depend on the installed version and configured directories; a replacement must point to the same module.

Use an alias from the project's resolved Nuxt configuration. Concrete replacements are suggested only when the alias base is known.

Example

Import shared code through #shared

Before

// server/api/events/[slug].get.ts
import { toVenueTime } from '../../../shared/utils/time'

After

import { toVenueTime } from '#shared/utils/time'
Copyright © 2026