nuxt-modules / tailwindcss

Tailwind CSS module for Nuxt
https://tailwindcss.nuxtjs.org
MIT License
1.66k stars 180 forks source link

[6.12] Tailwind viewer broken for nuxt2 and bridge #886

Open nhh opened 1 month ago

nhh commented 1 month ago

Environment

nuxt: 2.18.1 @nuxtjs/tailwindcss: 6.12.1

Reproduction

https://stackblitz.com/edit/nuxt-starter-z3wjs5?file=nuxt.config.js

Describe the bug

After upgrading the nuxt tailwindcss module, the tailwind viewer breaks.

Additional context

image

Logs

> nuxt dev

ℹ Using default Tailwind CSS file                                                                                               nuxt:tailwindcss 12:07:10
ℹ Module @nuxtjs/tailwindcss took 95.26ms to setup.                                                                                              12:07:10
ℹ Tailwind Viewer: http://localhost:3000/_tailwind/                                                                             nuxt:tailwindcss 12:07:11

   ╭───────────────────────────────────────╮
   │                                       │
   │   Nuxt @ v2.18.1                      │
   │                                       │
   │   ▸ Environment: development          │
   │   ▸ Rendering:   server-side          │
   │   ▸ Target:      server               │
   │                                       │
   │   Listening: http://localhost:3000/   │
   │                                       │
   ╰───────────────────────────────────────╯

ℹ Preparing project for development                                                                                                              12:07:11
ℹ Initial build may take a while                                                                                                                 12:07:11
ℹ Discovered Components: .nuxt/components/readme.md                                                                                              12:07:11
✔ Builder initialized                                                                                                                            12:07:11
✔ Nuxt files generated                                                                                                                           12:07:11

✔ Client
  Compiled successfully in 2.86s

✔ Server
  Compiled successfully in 2.37s

ℹ Waiting for file changes                                                                                                                       12:07:14
ℹ Memory usage: 0 B (RSS: 0 B)                                                                                                                   12:07:14
ℹ Listening on: http://localhost:3000/
ineshbose commented 1 month ago

I was trying to find what changes were doing to setting up the viewer between 6.11.4 and 6.12.1, and couldn't find anything... until I realised that we are adding the serverMiddleware in modules:done hook now. It's working on my PC, so I wonder if this is some race condition.

@danielroe thoughts on modules updating serverMiddleware in modules:done for Nuxt 2? (ignore this till after your holiday please)