Tailwind 4 requires restart to load changes on Webpack 5 #18179
-
What version of Tailwind CSS are you using? v4.1.8 What build tool (or framework if it abstracts the build tool) are you using?
What version of Node.js are you using? 20.17.0 What browser are you using? Chrome What operating system are you using? Mac OS Sonoma Reproduction URL Describe your issue Updating a code set to tailwind 4 has resulted in some dev server breakage. I'm under the impression that tailwind 4 is installed correctly:
I'm under the impression that Webpack 5 is set up for Hot Module Reload (HMR):
Feature I lost with upgrade:
What's going right: The dev server starts and stops without errors, and serves the page. Generally, "it works." What's not working: HMR (or manual) reloads appear to detect tailwindcss changes in the html, but the process of writing that style to the dev server stylesheet doesn't take place. When a tailwind class is added to the index.html, the style doesn't display. There is a void of style, instead. I am testing this with text colors on this repository. Introduced text color classes yield a dark text treatment (unstyled) and there is no style in the inspector relating to the tailwind class I just added. I can't get a new text color to appear without shutting down and restarting my dev server, but that does work, see "what's going right". You may find evidence in the repo of all the ways I've tried to fix this. I apologize if this amounts to errors due to me chasing my tail. I upgraded the code set manually and followed multiple sets of directions and used at least 15 keywords to search around other peoples' questions. It does look like others have reported other Hot Reload questions recently, so it seemed like it could be a bug. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I get the following errors when running
Do you have a |
Beta Was this translation helpful? Give feedback.
-
Using
Unfortunately not working on my case but was working till I stopped my dev server. |
Beta Was this translation helpful? Give feedback.
-
Hey! Since the webpack config is missing from that project I'm not sure how much I'll be able to help but I setup a test project here with working HMR: https://github.com/thecrypticace/webpack-v4-example You can run In your project I noticed that the |
Beta Was this translation helpful? Give feedback.
You'd want to use
style-loader
in dev mode, see the documentation for an example.