Skip to content

[v4] light-dark is broken in optimized build #15438

@imjeehoo

Description

@imjeehoo

What version of Tailwind CSS are you using?

4.0.0-beta.8

What build tool (or framework if it abstracts the build tool) are you using?

Next.js 15.1.1, postcss 8.4.49

What version of Node.js are you using?

Bun 1.1.40

What browser are you using?

Safari

What operating system are you using?

macOS 15.2

Describe your issue

Original description
I defined my own color: `@theme { --color-action-sheet-cancel: light-dark(white, #2c2c2e); }`

Color works fine in dev, but broken in production

bun run dev
image

bun run build && bun run start
image

With optimization enabled, LightningCSS exclusively respects the color-scheme declaration set on the html element, not elsewhere.

<html className="scheme-light dark:scheme-dark">
  <...>
    <div className="text-foreground">Hello</div>
    <div className="text-foreground scheme-only-dark">Hello</div>
  </...>
</html>

Without optimization:
image

With optimization:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions