Skip to content

Vite + Uniwind breaks dark: prefixes #554

@mkmakes

Description

@mkmakes

What happened?

Using Uniwind outside Expo with just Vite and React Native Web will cause dynamically generated theme class with the dark: prefixes to be bugged with the following error:

[vite] Internal server error: [lightningcss] failed to deserialize; expected an object-like struct named Specifier, found ()

The dark: token will break the build if it is detected anywhere by the static analysis, meaning even inside:

  • Code comments
  • Unreferenced files
  • Even the README.md!

Steps to Reproduce

  1. Clone the reproduction repo
  2. Prefix dark: to any dynamically generated Tailwind class that index.css specifies, such as dark:text-muted
// src/main.tsx
<Text className="flex justify-center p-10 text-foreground text-6xl dark:text-muted">
  Hello World
</Text>

Snack or Repository Link

https://codeberg.org/mkcodes/vite-uniwind-dark/

Uniwind version

1.7.0

React Native Version

N/A

Platforms

Web

Expo

No

Additional information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions