Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion packages/uniwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
"license": "MIT",
"style": "./uniwind.css",
"source": "src/index",
"react-native": "./src/index.ts",
"main": "./dist/common/index.js",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Main target has wrong format

When a legacy Node-compatible resolver uses the new main fallback, it loads dist/common/index.js. That file is generated as CommonJS, but the enclosing package declares "type": "module", so Node treats the .js file as ESM and require() cannot load it. As a result, consumers relying on the new fallback still cannot import the root package. Emit the artifact as .cjs or give dist/common a package manifest declaring "type": "commonjs".

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

greptile concern is valid, let's remove "main" field and keep only "react-native"

"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"
Comment on lines +48 to 53

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking this with publint, and we should keep "types" first - #687

Also why do we need to change this? Other exports untouched, and from my testing it looks that having "react-native" below the "browser" field works fine

},
Expand Down