Skip to content
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

[Bug?]: cssChunking / CSS Optimisations - Module CSS getting reset by tailwind's global styles #69311

Open
rohitpotato opened this issue Aug 26, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. Navigation Related to Next.js linking (e.g., <Link>) and navigation.

Comments

@rohitpotato
Copy link

Link to the code that reproduces this issue

https://github.com/GabenGar/repros/blob/main/nextjs/css-out-of-order/README.md

To Reproduce

  1. Upgrade to NextJs version 14.2.5
  2. Build prod
  3. Write some CSS inside a .module.css file.
  4. See the changes

Current vs. Expected behavior

Tailwind CSS's preflight styles overwrite Tailwind CSS written inside module CSS.

Example:

button.module.css

.button {
 @apply bg-red-500;
}

Expected Behaviour: Button color is red.

Current Behaviour: Button color is transparent since module CSS is overwritten by tailwind's preflight styles.

Provide environment information

Relevant packages:

Next - 14.2.5

Which area(s) are affected? (Select all that apply)

Not sure, create-next-app, Navigation

Which stage(s) are affected? (Select all that apply)

next build (local), Other (Deployed)

Additional context

We have a big legacy project where we have written tailwind classes inside module CSS by using the apply directive. At some places, these styles are being reset by Tailwind's preflight styles. This started happening after the next JS upgrade to version 14.2.5 and we are unable to move further.

I have tried the cssChunking as per the documentation but that is having no effect.

Is there any workaround? Rewriting everything back to tailwind classes is a very bandwidth heavy task for our team.

@rohitpotato rohitpotato added the bug Issue was opened via the bug report template. label Aug 26, 2024
@github-actions github-actions bot added create-next-app Related to our CLI tool for quickly starting a new Next.js application. Navigation Related to Next.js linking (e.g., <Link>) and navigation. labels Aug 26, 2024
@vercel vercel deleted a comment Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. Navigation Related to Next.js linking (e.g., <Link>) and navigation.
Projects
None yet
Development

No branches or pull requests

2 participants
@rohitpotato and others