matrix-org / matrix-org/matrix-js-sdk
browser-request is not compatible with react-native
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
Production build in react-native fails because the `browser-request` library tries to call `document.createElement` to check for cross-domain request (for CORS).
In React Native, `document` is not defined and CORS is not relevant.
The `browser-request` library has not been updated since 2014, so upstream fix seems very unlikely.
I propose dependency update to https://www.npmjs.com/package/xmlhttp-request which is a fork of `browser-request` that fixed this problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the package declaration for browser-request and inspect how the SDK's React Native production build resolves it. Evaluate the proposed xmlhttp-request replacement, then verify that the production build no longer reaches document.createElement and that the dependency is updated consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100