tailwindcss/integrations
Lazizbek Ergashev 50daebded0
Prevent @tailwindcss/vite crash under Vite's experimental bundledDev (#20379)
## Summary

Under Vite's experimental `bundledDev` mode, the `hotUpdate` hook in
`@tailwindcss/vite` gets called without a `server`. Vite only passes `{
type, file, modules }` here, but the hook loops over
`Object.values(server.environments)`, so editing any file (JS, CSS, or
HTML) throws `TypeError: Cannot read properties of undefined (reading
'environments')` and the dev server build fails.

The fix returns early when `server` is missing. Those environment loops
only look at environments other than the current one, and the
server-level `hot`/`ws` reload channels don't exist in this mode, so
bailing out leaves the classic (non-`bundledDev`) dev path untouched.

Fixes #20378

## Test plan

- Added a unit test that calls `hotUpdate` without a `server` and checks
it doesn't throw. It fails on the current code and passes with the
guard.
- Reproduced with a Vite 8 project using `experimental.bundledDev:
true`: before the change, editing any JS/CSS/HTML file crashed the dev
server; after it, edits work.
- `pnpm run test` and the `@tailwindcss/vite` integration suite both
pass.


[ci-all]

---------

Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
2026-08-03 15:10:06 +02:00
..
cli Fix weird character rendering on Windows with Japanese locale (#20318) 2026-07-14 17:04:20 +02:00
oxide chore: fix some typos in comments (#19475) 2025-12-22 13:09:19 +00:00
postcss Improve codebase quality (#19999) 2026-04-30 23:32:37 +02:00
turbopack Use default Turbopack mode in integration test 2026-07-31 15:13:38 +02:00
upgrade Update integration tests: PostCSS re-emits the UTF-8 BOM character (#20372) 2026-07-31 12:19:43 +02:00
vite Prevent @tailwindcss/vite crash under Vite's experimental bundledDev (#20379) 2026-08-03 15:10:06 +02:00
webpack Fix webpack loader cache key for resource queries (#19723) 2026-03-20 16:34:11 +00:00
package.json migrate to pnpm v11 (#20273) 2026-06-25 19:14:10 +02:00
utils.ts Add @tailwindcss/turbopack loader 2026-07-31 15:13:38 +02:00
vitest.config.ts Improve integration tests (stability + performance) (#15125) 2024-12-12 13:48:56 +01:00