From 1c5b23ddf5bfb96843036c9e3b1bd111374aef03 Mon Sep 17 00:00:00 2001 From: Antoine Rousseau Date: Mon, 21 Sep 2026 14:33:49 +0200 Subject: [PATCH] fix: add Metro fallbacks for the root uniwind entry Metro still consults `react-native` / `main` when it skips `exports`. Without those fields it looks for `index`, which does not exist. List `react-native` first in the `.` export map so native resolution wins condition matching. Co-authored-by: Cursor --- CONTEXT.md | 2 +- packages/uniwind/package.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index 315b7b88..705d1f7b 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -49,7 +49,7 @@ Public exports from `src/index.ts`: Package subpath exports: -- `uniwind`: main runtime API. +- `uniwind`: main runtime API. `package.json` also sets `react-native` (`./src/index.ts`) and `main` (`./dist/common/index.js`) so Metro can still resolve the root entry when it skips `exports` (no `main` previously made it look for `index`). The `"."` export lists `react-native` first so condition matching prefers the native entry. - `uniwind/components`: React Native component replacements. - `uniwind/components/*`: individual component replacements. - `uniwind/metro`: Metro adapter. diff --git a/packages/uniwind/package.json b/packages/uniwind/package.json index 099ffa57..f014a14e 100644 --- a/packages/uniwind/package.json +++ b/packages/uniwind/package.json @@ -41,12 +41,14 @@ "license": "MIT", "style": "./uniwind.css", "source": "src/index", + "react-native": "./src/index.ts", + "main": "./dist/common/index.js", "exports": { ".": { + "react-native": "./src/index.ts", "style": "./uniwind.css", "types": "./dist/module/index.d.ts", "browser": "./dist/module/index.js", - "react-native": "./src/index.ts", "import": "./dist/module/index.js", "default": "./dist/common/index.js" },