-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tailwind CSS base utilities not applied to production builds for TypeScript projects #14595
Comments
Think this is a tailwind bug actually, where it uses PurgeCSS only on |
Hey! Make sure you are configuring Tailwind to look through all the relevant files here: The example you started with is only looking for |
Ah, that did it. Feel a little silly for missing that. Thanks for the quick response! |
We'll want to update that example to also include |
Don't know how I got it wrong (as I was using it pre TailwindcssV2 and everything was fine). But changing |
i am having a same issue i created a next js website with tailwind css but when i deploy only the base style apply and all other styles not apply i name my components as .js how to fir this bug help |
For me work this code in tailwind.css: |
I am currently experiencing a similar issue. Here is my tailwind config module.exports = {
purge: ["./pages/**/*.{js, ts, jsx, tsx}", "./components/**/*.{js,ts,jsx,tsx}"],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
} I only have a |
I had this exact same issue and it will work when you change |
I've been trying to solve this complication for the past 2 hours. I've tried every method mentioned here. Still not working :( @adamwathan |
Same for me |
Experiencing this as well, and just found out that clearing the build cache or doing a |
None of the solutions mentioned here are working |
Can you folks please open issues on Tailwind itself if you're having problems and include a reproduction? I can't get this to happen in a fresh project, so if someone can provide a reproduction I'll have a much easier time figuring out the issue. |
@adamwathan I wasn't aware of the new JIT compiler. I will test this one out and see if the issue still occurs, but on my end, it only seems to happen during production builds on Vercel. Not on my local machine(s). |
Hi there everyone! I don't have a solution for this but I am experiencing the same issue. I will keep searching StackOverflow and let you know if I find something. Chat soon 🤙 |
@Nick-Achee Please open an issue here with a reproduction and we can fix it: https://github.com/tailwindlabs/tailwindcss Right now I have absolutely no information to go off of. I can't help unless someone gives me an example project, our own Next.js projects (we have many of them) don't suffer from this at all. |
@adamwathan - I went ahead and added the other file types to all purge paths and it fixed the issue. Working in production now. Thanks. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
Production builds of Next.js do not apply the base Tailwind utilities in the static build if any components in the
pages/
directory imports any external TypeScript components (such ascomponents/nav.tsx
), the build only apply the styling added into theTo Reproduce
yarn create next-app project-name
with-tailwindcss
example projectyarn add --dev typescript @types/react @types/node
components/nav.js
tocomponents/nav.tsx
yarn run build && yarn run start
http://localhost:3000
Expected behavior
That it would leverage the base Tailwind CSS utilities and appear as the default rather than the screen shot below.
Screenshots
The base utilities, such as flexbox, are lost. Only the styles using the

@apply
attribute instyles/index.css
are applied.System information
Additional context
This doesn't seem to happen if any page components are using TypeScript, only if the components that the page components import are using TypeScript.
The text was updated successfully, but these errors were encountered: