Next.js Discord

Discord Forum

Can't find CSS module in Route Group Layout

Answered
qwrts posted this in #help-forum
Open in Discord
Avatar
I'm trying to create another layout inside Route Group and importing CSS but the issue is once i loaded the page. The error appears: Module not found: can't resolve './globals.css'

And its weird that the autocomplete can't even find the global css file

- I tried move global.css into Public folder and import by /globals.css
- I tried keep the css file in root /app and using root path (@) and import it by import '@/globals.css'
- I tried set the path .././globals.css to pointing it in root /app folder
Image
Image
Image
Answered by West African Crocodile
in layout.tsx of root import './globals.css'
in nextjs, all of css file shared
good luck
View full answer

8 Replies

Avatar
West African Crocodile
in layout.tsx of root import './globals.css'
in nextjs, all of css file shared
good luck
Answer
Avatar
nothing wrong with the root layout but it happened in group route layout
Avatar
West African Crocodile
I mean you don't need import css file in other tsx files without root layout
ofc, when import css in root layout
Avatar
Oh i got it
How could i forget about this lmao
Avatar
West African Crocodile
I am alright
Avatar
thanks a lot for help