Skip to content

Production builds miss all classes from symlinked node_modules dependencies (bun + Tailwind CSS v4) #417

Description

@bibblebabl

When using bun as the package manager, arbitrary value classes from node_modules dependencies (e.g., HeroUI Native) are silently dropped in production/preview builds while working perfectly in dev.

Environment: Uniwind ^1.2.2, Tailwind CSS ^4.1.18, Bun 1.3.3, Expo ~54.0.33, HeroUI Native 1.0.0-rc.2

Root Cause

Bun stores packages via symlinks:

node_modules/heroui-native → ../../../node_modules/.bun/heroui-native@1.0.0-rc.2.../node_modules/heroui-native

The @source "./node_modules/heroui-native/src" directive tells Tailwind's Oxide scanner to scan the package. The scanner follows the symlink but there's a path mismatch in .gitignore allowlist logic — the canonical path (under .bun/.../node_modules/) gets excluded by the node_modules gitignore rule, and the allowlist doesn't match.

Arbitrary value classes (h-[56px], p-[3px], border-[1.5px], etc.) that only exist in the library source are never generated.

Why Dev Works but Production Doesn't

  • Dev: Uniwind's Metro JIT plugin generates styles at runtime. Oxide scanner not involved. All classes work.
  • Production: CSS is pre-compiled via the Oxide scanner. Symlinked dependency is not scanned → library-only classes missing.

Workaround

@source "./node_modules/heroui-native/src";
@source inline("h-[36px] h-[48px] h-[56px] p-[3px] -my-[3px] py-[3px] top-[3px] w-[48px] h-[24px] left-[2px] w-[28px] h-[20px] right-[2px] p-[2px] pt-[3.5px] h-[6px] w-[6px] border-[1.5px]");

Fragile — requires updating on every library upgrade.

Upstream

Tracked at tailwindlabs/tailwindcss#17985.

Possible Uniwind-level mitigations

  1. Document the workaround for bun users
  2. Auto-generate safelist during production builds — scan resolved dependency sources at the JS level and emit @source inline(...) transparently
  3. Resolve symlinks before passing to Oxide — if Uniwind controls @source path resolution, resolve to canonical paths directly

Reproduction

  1. Expo + RN project with Uniwind, bun as package manager
  2. Install a library using Tailwind arbitrary values (heroui-native)
  3. Add @source "./node_modules/<package>/src" to global.css
  4. Build preview/production (eas build --profile preview --local)
  5. Components with arbitrary classes have broken layouts
  6. Compare with dev where everything renders correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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