Tailwind classes aren't applying in dev and sometimes in production when login via credentials
Tailwind classes aren't applying in dev and sometimes in production when login via credentials, it acts normal when I close VS code and then start it again and do a napm run dev.
Also for some weird reason Tailwind also stops applying when I log in via credentials (I am using Next Auth for a custom login page)
6 Replies
hm I've seen similar happen in a scenario like this
- tailwind config includes
/old/path/foo.tsx
but not /new/path/bar.tsx
- both use bg-red-500
- if you first go to a page using foo.tsx
then the class loads, and if you then go to the page using bar.tsx
the class still exists so it seems to be working
- but if you reload on that page, the class disappears because bar.tsx
isn't actually covered by tailwind's config
this would line up with your auth doing some kind of reload, and reloading more aggressively in dev
double check all your files are covered like ./src/**/*.{tsx,jsx,html,etc}
for context both of these are on the same route but one is in local dev and other on is live on vercel
@michaeldrotar
understood, I was just simplifying the explanation
so in your config you cover these 4 folders and you cover ts and tsx files
have you added any other folders or file extensions (js, jsx, md, mdx) that use tailwind but aren't covered here?
in my scenario I had added a
./featureA
folder that I started putting components and utils related to that feature into so I had to update the configthe problems started after I started using a route group
so I could have specific pages that have a top header
I don't add (js, jsx, md, mdx) files, i am using purely tsx files
I can give a link to my github repo if needed
@michaeldrotar was your issue also temp fixed by restarting the dev environment?