Laravel Mix HMR CSS and Tailwind class generation breaks when compiling 2 JS files
See original GitHub issueWhat version of Tailwind CSS are you using?
2.2.15
What build tool (or framework if it abstracts the build tool) are you using?
Laravel Mix 6.0.6
What version of Node.js are you using?
v14.17.0
What browser are you using?
Firefox Developer Edition, Chrome, …
What operating system are you using?
macOS Big Sur
Reproduction repository
https://github.com/sebastiaanluca/tailwind-hmr-bug
Describe your issue
In a fresh Laravel application served with Valet, Tailwind JIT mode doesn’t create classes or update app.css
for classes used in Vue components when using hot reload (mix watch --hot
or TAILWIND_MODE=watch mix watch --hot
) in combination with compiling 2 JS files (as far as I was able to reproduce). The watcher runs fine and it builds the files, but it won’t create and inject the CSS.
It works fine in Blade views because BrowserSync refreshes the page for you, but not in Vue components where the CSS is injected when using hot reload. It’ll also create them when running npm run watch
, npm run dev
, or npm run production
.
It took a while to find the issues, but I’ve successfully reproduced the bug in a fresh Laravel app: https://github.com/sebastiaanluca/tailwind-hmr-bug
I had this issue in my main app and thought the cause was BrowserSync or some odd configuration, but I followed the installation instructions from scratch (https://tailwindcss.com/docs/guides/laravel) and updated it to use JIT mode (https://tailwindcss.com/docs/just-in-time-mode).
Similar issue to https://github.com/tailwindlabs/tailwindcss/issues/4978, https://github.com/tailwindlabs/tailwindcss/issues/5135, and https://github.com/tailwindlabs/tailwindcss/issues/4833.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (1 by maintainers)
Gonna try and look into this for you tomorrow ❤️
I’ve opened https://github.com/laravel-mix/laravel-mix/issues/3225 to track this and will handle it over there.