-
Notifications
You must be signed in to change notification settings - Fork 54
fix: add Metro main/react-native fallbacks for the root entry #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,12 +41,14 @@ | |
| "license": "MIT", | ||
| "style": "./uniwind.css", | ||
| "source": "src/index", | ||
| "react-native": "./src/index.ts", | ||
| "main": "./dist/common/index.js", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. greptile concern is valid, let's remove |
||
| "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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a legacy Node-compatible resolver uses the new
mainfallback, it loadsdist/common/index.js. That file is generated as CommonJS, but the enclosing package declares"type": "module", so Node treats the.jsfile as ESM andrequire()cannot load it. As a result, consumers relying on the new fallback still cannot import the root package. Emit the artifact as.cjsor givedist/commona package manifest declaring"type": "commonjs".