Skip to content

Finish the icon consolidation: bump the ui pointer, once ui-docs can resolve lucide-react-native in CI #795

Open

Description

@thinkclay

Split out of #793 so the Sentry removal could land. The ui-side work is done and merged; only the parent's submodule pointer bump is outstanding.

What is already merged, on Scaffald/ui

What is blocked

Bumping packages/ui in this repo to a3d473c fails @scaffald/ui-docs:build in CI:

Module not found: Error: Can't resolve 'lucide-react-native'
  in '<repo>/packages/ui/dist'

Notable, and the reason this needs someone to look rather than guess again:

  • It passes locally. pnpm nx run @scaffald/ui-docs:build exits 0 in a fresh worktree with the pointer at a3d473c.
  • It is not flaky. Re-running the failed CI job reproduces it.
  • Declaring the dependency on the docs site (ui#32) did not fix CI, though it is correct on its own terms.
  • The committed lockfile does record lucide-react-native under packages/ui/docs-site.
  • webpack resolves from packages/ui/dist, so it walks packages/ui/node_modules → packages/node_modules → root node_modules. lucide-react-native is a dependency of both @scaffald/ui and the root package, so it should be reachable in all of them.

The difference between the two environments is what needs finding. Likely candidates: how actions/checkout with submodules: true lays out the submodule versus a local git submodule update, or pnpm hoisting differing between a cold CI install and a warm local one.

Worth deciding at the same time

lucide-react-native still ships whole — 1.14 MB for the 147 icons actually used, because Metro does not tree-shake its barrel. Options, in rough order of cost:

  1. Deep imports (lucide-react-native/dist/esm/icons/<name>) instead of the barrel. ~1 MB, mechanical codemod over 369 files, no visual change.
  2. Migrate to @expo/vector-icons — not currently installed or imported anywhere. Needs a 147-icon name mapping and changes every icon's appearance across the app; a design decision, not just a perf one.

Acceptance

  • @scaffald/ui-docs:build passes in CI with the pointer at a3d473c or later
  • packages/ui pointer bumped, lucide-react gone from the bundle (verify by source-map attribution: lucide* should drop 2.20 MB → 1.14 MB)
  • A decision recorded on whether the remaining icon set stays lucide with deep imports, or moves

Related: #791 (audit), #793 (Sentry half, merged), Scaffald/ui#31, Scaffald/ui#32.

Activity

  1. thinkclay commented on Sep 17, 2026

    @thinkclay
    ContributorAuthor

    Status check on main at c67f930d2 (2026-09-17):

    Boxes 1 and 2 appear to have landed without this issue noticing. #794 bumped the packages/ui pointer to 91e5fb693, which is after a3d473c (the compare shows ui#33, #34, #35, #36 on top of it), and CI on that commit is green — including Lint, typecheck & build, whose nx run-many -t build builds @scaffald/ui-docs. At that pointer the ui package.json lists only lucide-react-native, and src/components/Breadcrumb/ has no BreadcrumbIcons.web.tsx. So the CI-only resolution failure was fixed by ui#36 ("stop aliasing lucide-react-native to a package #31 removed"), which is what this issue was waiting for.

    What is still owed before closing boxes 1–2: the bundle proof. One expo export --platform web --source-maps on main and the #791 attribution — lucide* should read ~1.14 MB, not 2.20 MB.

    On box 3 (what to do about the remaining 1.14 MB), add an option 0 ahead of the deep-import codemod:

    1. Try Metro's experimental tree shaking first. lucide-react-native declares sideEffects: false, which is exactly what EXPO_UNSTABLE_TREE_SHAKING=1 EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 expo export needs. One export, one attribution; if it works it is zero code change and also trims zod, awesome-phonenumber and our own barrels. If it does not survive the hydration audit (scripts/audit/hydration-pages.mjs) or breaks the server bundle, fall back to option 1.

    Note for option 1 if it is needed: the package's exports map exposes only . and ./icons (itself a barrel), and metro.config.js:19 has unstable_enablePackageExports = true, so lucide-react-native/dist/esm/icons/<name> would be blocked by the exports map unless the resolver gets an exception. 246 files on main import the barrel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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