Skip to content
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

fix(react-native): add aliasFields to handle replaced files in browser env #16106

Merged
merged 2 commits into from
Apr 6, 2023

Conversation

Singloo
Copy link
Contributor

@Singloo Singloo commented Apr 5, 2023

Current Behavior

browser field in package.json can be an object, hints some files need to be replaced when packaging. Currently, pnpm module resolver doesn't do the file replacements.

e.g.
When resolving picocolors, module resolver resolves to the wrong entry file.
Current behavior: …/node_modules/picocolors/picocolors.js

Picocolors has the following package.json

"name": "picocolors",
  "version": "1.0.0",
  "main": "./picocolors.js",
  "types": "./picocolors.d.ts",
  "browser": {
    "./picocolors.js": "./picocolors.browser.js"
  }

Expected Behavior

Should resolve to …/node_modules/picocolors/picocolors.browser.js

Related Issue(s)

Fixes #16105

@vercel
Copy link

vercel bot commented Apr 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Apr 6, 2023 1:53am

@Singloo Singloo changed the title Bug fix/fix rn pnpm resolver alias Bug fix/fix rn pnpm resolver alias fields Apr 5, 2023
@xiongemi xiongemi changed the title Bug fix/fix rn pnpm resolver alias fields fix(react-native): add aliasFields to handle replaced files in browser env Apr 5, 2023
@xiongemi
Copy link
Collaborator

xiongemi commented Apr 5, 2023

@Singloo the pr looks good. however, the ci check failed. could you rebase and trigger the ci to run again?

@Singloo Singloo force-pushed the bug-fix/fix-rn-pnpm-resolver-alias branch from f0d2b29 to bb20ad1 Compare April 6, 2023 01:53
@Singloo
Copy link
Contributor Author

Singloo commented Apr 6, 2023

@xiongemi done

@xiongemi xiongemi merged commit 7a4adf5 into nrwl:master Apr 6, 2023
FrozenPandaz pushed a commit that referenced this pull request Apr 11, 2023
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

React native, Pnpm: browser field in package.json not been probably resolved
2 participants