-
SummaryHello peeps, I am having a weird issue in which Tailwindcss classes are not being recognized on a NextJS v15 app. I am using the bun toolkit for building my app Anyhow, say I have a I am using NextJS relevant package.json {
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@radix-ui/react-slot": "^1.2.0",
"@supabase/ssr": "^0.6.1",
"@supabase/supabase-js": "^2.49.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.487.0",
"motion": "^12.6.3",
"next": "15.2.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwind-merge": "^3.2.0",
"tw-animate-css": "^1.2.5"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@tailwindcss/postcss": "^4",
"tailwindcss": "^4",
"eslint": "^9",
"eslint-config-next": "15.2.4",
"@eslint/eslintrc": "^3"
}
} relevant code snippet import { TypographyH1 } from '@/components/ui/typography'
import Image from 'next/image'
export default function TestPage() {
return (
<main className="p-4">
<TypographyH1>Test Page</TypographyH1>
<div className="relative" style={{ position: 'relative' }}>
<Image src={'/img.webp'} alt="image" width={1808} height={3216} />
<div className="bg-red-400 p-2 rounded-md absolute bottom-0 right-0">
DIV
</div>
</div>
</main>
)
} (setting the I found a similar issue being reported #76761 Has this happened to anybody else? EDIT: fyi, this is happening to me on a particular project. New projects created in the same manner does not seem to have this problem. Also, the project that is having this issue did not always had that problem; I used to put classNames and those would show up just fine. So idk what is going on, I might upgrade NextJS to see if that fixes it. EDIT 2: I did upgrade from Tailwind v3 to v4 on this project. Also NextJS v14 to v15. EDIT 3: Its definetly something with this project in particular. I copied the whole thing to another directory and it has the same issues. I am slowly investigating by adding files step by step to another project that as of this writting does not have the issue. I cry 😢 EDIT 4: I am gonna do testing by the file :) EDIT 6 potential solution: I think i found a "fix", I will give the details later on a reply once I do some testing. Spoiler alert, its kinda dumb imo. Additional informationOperating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Mon Apr 7 19:01:38 UTC 2025
Available memory (MB): 7572
Available CPU cores: 8
Binaries:
Node: 22.14.0
npm: 10.9.0
Yarn: N/A
pnpm: 9.13.2
Relevant Packages:
next: 15.2.4 // There is a newer version (15.3.0) available, upgrade recommended!
eslint-config-next: 15.2.4
react: 19.1.0
react-dom: 19.1.0
typescript: 5.8.3
Next.js Config:
output: N/A
⚠ There is a newer version (15.3.0) available, upgrade recommended!
Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
Read more - https://nextjs.org/docs/messages/opening-an-issue ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Could you share some screenshots of what's happening on the browser? or more detailed code snippets? I wonder if it is a layers issue, or maybe related to https://tailwindcss.com/docs/detecting-classes-in-source-files, but also that the Next.js version upgrade fixes the issue is kind of weird. |
Beta Was this translation helpful? Give feedback.
-
Hey! Yeah, this definitely sounds like a weird one—but thanks for the detailed report, it helps a lot. Based on what you're describing and the fact that: The className is visible in the HTML But the styles aren’t applied It works on a fresh new project It used to work before
|
Beta Was this translation helpful? Give feedback.
-
I won't say anything about a solution perse. I will just tell my story for now. So, in the project that I was having problems with tailwindcss classes not having an effect on the dom. I had a I think something related to that I will note that the newly renamed I have been trying to figure why all of this happens for ~5 hours. Did I wasted my time? Maybe. But idk, I feel something is up here. I will mark this as an answer (don't name your routes as Again, there is a similar issue on this topic (#76761) screenshotsExpected behavior on Actual behavior on After renaming I can now change some raw notes for context
|
Beta Was this translation helpful? Give feedback.
I won't say anything about a solution perse. I will just tell my story for now.
So, in the project that I was having problems with tailwindcss classes not having an effect on the dom. I had a
app/test/page.tsx
file. The file contained the relevant code snippet found on the discussion above. I then created aapp/test2/page.tsx
andapp/some-page/page.tsx
. Interestingly, tailwind worked as normal on thesome-page
page. Meanwhile, thetest
andtest2
pages had the problem. I used the same code snippet for all 3. I then renamedtest2
towth
and it worked as normal too!. I then renamedtest
tosomething-else
and it tailwind worked as normal there too.I think something related to that
test
filen…