Tailwind CSS Vite Plugins and Client-only bundle #1113
Closed
philipp-spiess
started this conversation in
Proposal
Replies: 1 comment 11 replies
-
Hi @philipp-spiess, thanks for posting. You are indeed correct that client code (not just client-only) gets built after the server SSR code. That's because the way we detect these client components (Like Giving you better hooks is possible though. Am I understanding correctly that you want to update the main bundle based on the classes you discover in the client components? |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We’re currently investigating an issue with our new Vite plugin in combination with the client-only builds: tailwindlabs/tailwindcss#15794
The way the Tailwind CSS Vite plugin works is that it leverages the Vite module tree to scan for used class names and then, when the build is done, it will update the
.css
files with the complete list of necessary classes.However, when Astro builds the client-only bundle, this seems to happen after the main static bundle is already created. This means that by that time, the main
.css
file is already finalized and we can't make changes to it anymore.I wonder if it's possible to add some hooks that we can use to fix this or maybe make it possible to reorder the build steps somehow?
Beta Was this translation helpful? Give feedback.
All reactions