-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Nuxt integration #14319
Fix Nuxt integration #14319
Conversation
2a0cce8
to
3d6da3d
Compare
3d6da3d
to
cf93f8a
Compare
@@ -169,7 +168,7 @@ export default function tailwindcss(): Plugin[] { | |||
}, | |||
transform(src, id, options) { | |||
let extension = getExtension(id) | |||
if (extension === '' || extension === 'css') return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an optimization that makes sure vite <style>
blocks aren't scanned for candidates in addition to css
files.
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
- Ensure content globs defined in `@config` files are relative to that file ([#14314](https://github.com/tailwindlabs/tailwindcss/pull/14314)) | |||
- Ensure CSS `theme()` functions are evaluated in media query ranges with collapsed whitespace ((#14321)[https://github.com/tailwindlabs/tailwindcss/pull/14321]) | |||
- Fix support for Nuxt projects in the Vite plugin (requires Nuxt 3.13.1+) ([#14319](https://github.com/tailwindlabs/tailwindcss/pull/14319)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not happy about this line but if we want to mention the improved Nuxt support we should mention the version number, otherwise people try it and it won't work 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me tbh
@@ -193,7 +192,7 @@ export default function tailwindcss(): Plugin[] { | |||
// The reason why we can not rely on the invalidation here is that the | |||
// users would otherwise see a flicker in the styles as the CSS might | |||
// be loaded with an invalid set of candidates first. | |||
await server?.waitForRequestsIdle?.(id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to bump the minimum Vite version to the one where waitForRequestsIdle
was introduced if it's not already btw.
We noticed that Nuxt projects were not working with the tailwindcss project. The issue was traced down to the fact that Nuxt starts multiple Vite dev servers and calling the experimental
waitForRequestsIdle()
on one of the test servers would never resolve.This was fixed upstream and is part of the latest Vite/Nuxt release: vitejs/vite#17980.
We still need to handle the fact that Vite can spawn multiple dev servers. This is necessary because when we invalidate all roots, we need to find that module inside all of the spawned servers. If we only look at the last server (what we have done before), we would not find the module and thus could not invalidate it.