Skip to content

Bug: vite warnings when minifying css - Empty :where() generated #16582

Open
@Damato

Description

@Damato

The code in question:

  body::-webkit-scrollbar {
        @apply bg-zinc-100 dark:bg-zinc-800;
  }

The error on bundling:

  warnings when minifying css:
  ▲ [WARNING] Unexpected ")" [css-syntax-error]

  <stdin>:14:30:
        14 │ body::-webkit-scrollbar:where(){background-color:var(--color-zinc-...
           ╵                               ^

  ▲ [WARNING] Unexpected ")" [css-syntax-error]

  <stdin>:16:36:
        16 │ ...:-webkit-scrollbar-thumb:where(){border-color:var(--color-zinc-...
           ╵                                   ^

General detail

I am stumped, as I am getting weird behaviours on CSS minification.

In digging deeper it seems that it generates an empty where() when it should generate none.
It is only on build, and it is valid CSS that gets altered. Details are added below.

I also found the same recently reported behaviour in the daisyui repo. It seems they are struggling with an empty :is() being generated. It is a consistent pattern, as I do not use daisyui, but both our projects include Tailwind 4, and same type of issue.

Link for reference.
saadeghi/daisyui#3453

Happy to provide more data as needed, to make lives easier for devs and anyone else with the issue.


What version of TailwindCSS are you using?

  "tailwindcss": "^4.0.4",

Project detail

  "@sveltejs/kit": "^2.16.0",
  "@sveltejs/vite-plugin-svelte": "^5.0.0",
  "@tailwindcss/vite",
  "vite": "^6.0.0"

Command / IDE

  vite build
  VS Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions