Skip to content

Upgrade React v19 and Tailwind v4 #9

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

raix
Copy link
Contributor

@raix raix commented May 9, 2025

Updating all dependencies - biggest ones are React v19 / Tailwind v4 / RAC + testing rspress v2 beta

Draft:

@raix raix added the enhancement New feature or request label May 9, 2025
@raix raix self-assigned this May 9, 2025
@SoonIter
Copy link

SoonIter commented May 15, 2025

hey rspress guys, any blocking points when migrating to Rspress 2.0-beta.5 :D

Waiting for web-infra-dev/rspress#1967 due to preflight.css style / reset issue breaking Tailwind. (hoping for better namespacing)

Could you provide some details or how can I help you bypass it?

https://github.com/web-infra-dev/rspress/blob/17dc8228de3fad421f80ff8a09e70d7dca4be8f7/packages/theme-default/src/styles/base.css#L74

the preflight.css within Rspress is forked from tailwind V3, are these color css variables conflicted with v4?

@raix
Copy link
Contributor Author

raix commented May 15, 2025

Hey @SoonIter thanks for reaching out ❤️

I'm using Tailwind v4 for styling the content / component library - but due to the order of loaded styles it seems like the preflight.css is overwriting the Tailwind styles.

Buttons render without padding etc.
CleanShot 2025-05-15 at 14 36 08

When disabling the preflight styles for button:
CleanShot 2025-05-15 at 14 37 01

Let me know if I can help out in any way or provide more insights

@SoonIter
Copy link

I'm using Tailwind v4 for styling the content / component library - but due to the order of loaded styles it seems like the preflight.css is overwriting the Tailwind styles.

I judge from your screenshot that this issue should be the default style declaration of tailwind v4 in the @layer, causing it to have a lower priority than the preflight.css style within Rspress.

Almost all component libraries have a preflight.css to smooth out browser differences so does rspress, perhaps Rspress cannot support this issue by modifying the code of preflight.css... sorry

so this issue should be checked to see if the tailwind v4 community has a solution.

tailwindlabs/tailwindcss#15864

@raix
Copy link
Contributor Author

raix commented May 15, 2025

@SoonIter when looking into the generated styles.css file - the application / user space styling is in the top, then a reset/preflight.css followed by rspress.

Meaning styles in user space would always have lower priority than the reset?

Not sure if it's an issue in rspress / Tailwind or in our configuration - one could argue that presets / resets / preflight should be on the first layer of priority / "base".

Example:

/* @import "tailwindcss"; */
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/preflight.css" layer(base);
@import "tailwindcss/utilities.css" layer(utilities);

@raix
Copy link
Contributor Author

raix commented May 15, 2025

Looking at the @rspress/theme-default it seems like using Tailwind 3.x - might also explain why the preflight is not on a layer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants