| 1 | import tailwindcss from "@tailwindcss/vite"; |
| 2 | |
| 3 | /** Adapts Tailwind's dev hooks to Vite's experimental bundled mode. */ |
| 4 | export function tailwindPlugins(bundledDev: boolean) { |
| 5 | const plugins = tailwindcss(); |
| 6 | if (bundledDev) { |
| 7 | for (const plugin of plugins) { |
| 8 | // This hook expects Vite ModuleNodes and a server, which Rolldown does |
| 9 | // not supply. Bundled dev tracks Tailwind's addWatchFile dependencies |
| 10 | // and rebuilds CSS when those files change without this hook. |
| 11 | delete plugin.hotUpdate; |
| 12 | } |
| 13 | } |
| 14 | return plugins; |
| 15 | } |