mapbox / mapbox/mapbox-gl-directions
XMLHttpRequest is not defined
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 255
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
I'm building a React app using Remix (SSR) and ran into issues with XMLHttpRequests in this package, which aren't supported by Node. My workaround was to use yarn patch and packageExtensions to add xhr2 as a dependency and replace the existing requests in dist/mapbox-gl-directions.js.
Wondering if anyone else has encountered this and if there might have been a better solution. I noticed that the demo @teaden made had no issues so I'm thinking it might have to do with using an SSR framework.
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
Reproduce the XMLHttpRequest failure in a Remix SSR environment and inspect dist/mapbox-gl-directions.js, comparing its requests with the yarn patch and packageExtensions workaround using xhr2. Done would mean identifying and agreeing on an SSR-compatible request approach, with the behavior verified in the reported React and Node context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, react
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100