Fix Nuxt integration#14319
Merged
Merged
Conversation
2a0cce8 to
3d6da3d
Compare
3d6da3d to
cf93f8a
Compare
philipp-spiess
commented
Sep 4, 2024
| }, | ||
| transform(src, id, options) { | ||
| let extension = getExtension(id) | ||
| if (extension === '' || extension === 'css') return |
Contributor
Author
There was a problem hiding this comment.
This is an optimization that makes sure vite <style> blocks aren't scanned for candidates in addition to css files.
philipp-spiess
commented
Sep 4, 2024
|
|
||
| - 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)) |
Contributor
Author
There was a problem hiding this comment.
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 😢
| // 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) |
Contributor
There was a problem hiding this comment.
We need to bump the minimum Vite version to the one where waitForRequestsIdle was introduced if it's not already btw.
thecrypticace
approved these changes
Sep 4, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.