Next.js Discord

Discord Forum

Issue with alias next.js 15 default config

Unanswered
Britannia Petite posted this in #help-forum
Open in Discord
Britannia PetiteOP
Hi, got some issue with default alias @ in next.js 15, i'm using TS.
ts compiler options:
        "baseUrl": ".",
        "paths": {
            "@/*": ["./src/*"]
        }


and got :

Module not found: Can't resolve '@/components/ui'

in layout.tsx
for
import { Menu } from "@/components/ui";


file structure:

src/
    layou.tsx
    components/
      /ui
        Menu.tsx


Any help would be appreciated 🙂 thank you !

3 Replies

If you want to just be able to import from @/components/ui you will need an index.ts file inside that folder that exports all the components
e.g.
export * from "@/components/ui/Menu";
Britannia PetiteOP
Yes of course, but I don’t have any auto completion for all imports