-
Notifications
You must be signed in to change notification settings - Fork 127
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
XMLHttpRequest is not defined #289
Comments
Hi, I have the same issue with angular, I tried what you did with xhr2 dependency but it doesn't work for me. |
@spencerjsmall could you show some code on how you fixed this? Using Nextjs and having the exact same issue. |
@renzik At the top of dist/mapbox-gl-directions.js I included |
Bumping this thread if anyone has found alternative fixes to the issue. |
Any ideas to fix this issue? |
When I tried the fix it gives me the error:
|
Yeap solved it using,
You can do this in your _app.ts if you are using nextjs@12 or in |
Hello, thanks @jeremyrajan . Your solution works form me.
Thanks |
Hey i have a similar problem in my nextjs application. global.XMLHttpRequest = require("xhr2"); error: ..\node_modules\grpc-web\index.js (18:499) @ self
app:dev: - error Error [ReferenceError]: self is not defined stack: |
same problem , have you managed to fixed it yet? |
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
andpackageExtensions
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.
The text was updated successfully, but these errors were encountered: