Next.js Discord

Discord Forum

tailwind image - module not found

Unanswered
Almond stone wasp posted this in #help-forum
Open in Discord
Almond stone waspOP
hi
<div className='w-full rounded-t-2xl bg-[url("/images/card/background.png")] bg-cover bg-center'></div>
why do i get the following error ?
web:dev: Module not found: Can't resolve 'images/card/card-background.png'
web:dev:   1938 | .bg-\[url\(\"images\/card\/card-background\.png\"\)\] {
web:dev:   1939 |   background-image: url("images/card/card-background.png");
web:dev: > 1940 | }

i am using next.js and tailwind css.

15 Replies

Caribbean Elaenia
Do you have the image in the public directory?
@Almond stone wasp
Almond stone waspOP
Yes
I have
Caribbean Elaenia
Alright, I think I know the issue
You're using NextJS, right?
Could I see your tailwind config file?
Almond stone waspOP
yes
Caribbean Elaenia
I think it's possible for you to import the image directly
Using import
And you could then use it
Almond stone waspOP
thanks
🥰
Caribbean Elaenia
Did it work?
Almond stone waspOP
yes thanks