Nuxt · Imports

NUXT0096Import across Nuxt directories through an alias

Flags imports that climb two or more directories in app/, server/ or shared/.

Why it happens

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.

Fix

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'

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

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