-
-
Notifications
You must be signed in to change notification settings - Fork 841
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
[Start] CSS files in node-server build don't work with Tailwind 4.0 #2899
Comments
do you mean "generated CSS"? |
The CSS files are identical, but the HTML is always referencing the CSS of the server-side import which is not accessible from the client. |
but doesn't the hash describe the content somehow? so why do they have different hashes if they are identical? |
I'm not sure, could it be hash is also time-based? |
Okay, I double checked and you are right, the files are not 100% identical. Not sure if or how it's linked to Start though |
This bug is still present after upgrading the tanstack packages to latest, bumping vinxi to 0.5.1, and setting the vite override to 6.0.3 🤔 |
This may not be because of Start indeed, so I'd be happy to move it to a more relevant project of course! I see there's the "information needed" tag but I'm not sure you need more information from me; how may I help? |
@glecetre added the label in, just to mark that we currently have no clue where is this is originating from. |
It seems to work on React 19.
|
Had the same issues. Upgrading to React 19 did not fix it. However it works when using PostCSS instead of the vite plugin of Tailwind v4 |
This issue still persists on Tailwind v4.0 stable release. |
I found the solution here: https://discord.com/channels/486935104384532500/1314368269544722452/1314368269544722452 You need to set the base path explicitly so that both builds (client and server) are treated the same way (see also https://tailwindcss.com/docs/detecting-classes-in-source-files#setting-your-base-path) e.g. in the reproducer: diff --git a/app/styles/app.css b/app/styles/app.css
index 32ca3cc..8f0e000 100644
--- a/app/styles/app.css
+++ b/app/styles/app.css
@@ -1,4 +1,4 @@
-@import "tailwindcss";
+@import "tailwindcss" source("../");
@layer base {
html, |
Thanks @schiller-manuel your solution worked for me! Although VSCode shows invalid syntax. Let's see if there's a way to fix that |
Which project does this relate to?
Start
Describe the bug
When using TailwindCSS v4.0 beta, the node-server build has problems with stylesheets.
Here's a repro repo: https://github.com/glecetre/tanstack-start-tailwind-beta.
It works without issue in dev (
pnpm dev
) but doesn't on the built app (pnpm build && node .output/server/index.mjs
.)From what I can gather (I don't fully understand the build process), the CSS file generates at least two different assets:
.output/public/assets/app-{hash}.css
and.output/public/_build/assets/app-{hash}.css
. I think it's for server-side and client-side import. The problem is that these assets don't have the same hash, but the generated HTML doesn't seem to make a difference.Example of generated assets:
Here's the HTML's link tag for this resource:
<link rel="stylesheet" href="/_build/assets/app-DMI6-ub3.css">
.I understand that Tailwind 4.0 being in beta, this issue may not be relevant until the release candidate in which case it could be closed without further investigation. Thanks!
Your Example Website or App
https://github.com/glecetre/tanstack-start-tailwind-beta
Steps to Reproduce the Bug or Issue
pnpm i
pnpm dev
--> all goodpnpm build && node .output/server/index.mjs
--> not all goodExpected behavior
As a visitor I expect to see the page with styling.
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: