Skip to content

Conversation

@AlemTuzlak
Copy link
Contributor

It seems this change makes the below mentioned issue go away and seems to generate the correct tailwindcss output file durring the ssr build. Big shoutout to @rossipedia for figuring this out.

I think you guys might want to take this over and own it as I'm not sure about other implications and if it breaks any other framework.

Fixes #15237

@AlemTuzlak AlemTuzlak requested a review from a team as a code owner December 2, 2024 20:37
@thecrypticace
Copy link
Contributor

Ah this is interesting. I was just heads down looking into this and found it was related to SSR when the user config explicitly overrides ssr.resolve.conditions but came up with a different fix:

ssrConfig: {
  resolve: {
    conditions: ['style', 'development|production'],
  },
},

This fixes it in Vite 5 but isn't needed at all Vite 6 because it just works as expected. Gonna look into the aliasOnly thing a bit because that would be a cleaner fix assuming it's the right one.

@thecrypticace
Copy link
Contributor

I think this fix is the correct one. Looking into it (and the original problem) the aliasOnly flag causes Vite to consider aliases but not SSR stuff, externals, fs paths, etc… which shouldn't be a problem here.

Just needs tests (don't worry I'm gonna add these)!

@thecrypticace thecrypticace changed the title fix: Added support for vite build --ssr to the tailwind vite plugin Fix resolution of imported CSS files in Vite SSR builds Dec 2, 2024
@thecrypticace thecrypticace merged commit 93b922d into tailwindlabs:next Dec 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tailwind 4 does not work with react-router v7 framework mode

2 participants