Skip to content

Conversation

@philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Sep 3, 2024

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.

@philipp-spiess philipp-spiess changed the title Add Nuxt integration test Fix Nuxt integration Sep 4, 2024
@philipp-spiess philipp-spiess marked this pull request as ready for review September 4, 2024 11:51
},
transform(src, id, options) {
let extension = getExtension(id)
if (extension === '' || extension === 'css') return
Copy link
Contributor Author

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.


- 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))
Copy link
Contributor Author

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 😢

Copy link
Contributor

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

// 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)
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants