-
Notifications
You must be signed in to change notification settings - Fork 56
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
default port on localhost #30
Comments
Unable to reproduce. This worked fine for me using https://gist.github.com/mbostock/fd652a3fc1a41243d92e2cee6cbd6711 |
I'm able to consistently reproduce this, but only in a commonjs environment. I ran your code locally and it worked as expected, and tested using rollup to build a bundle (repo here) and that also worked as expected. However, using commonjs I get the behavior described above, unclear why. To reproduce easily, I've made a repo to help reproduce the problem: https://github.com/mathisonian/d3-request-test-cjs. |
It’s because you are consuming the code that is targeted at Node and has an XMLHttpRequest polyfill, rather than code targeted at the browser. You need to use the module entry point if you are using a browser-targeting bundle. (Or, you can rebundle the UMD provided with the release.) |
Got it - thanks @mbostock. |
You are very welcome! Sorry for the lost time. |
Thanks @mathisonian and @mbostock. You saved my day. |
I'm having the same issue here using |
When I'm running a server on localhost on some port, say 3000, and use d3-request to reference a file from the root url, e.g.
this sends a GET request to
http://localhost/my-data.json
, while I'd expect it to be routed tohttp://localhost:3000/my-data.json
. To be clear the javascript and html is loading fromlocalhost:3000
as well in this case.Using superagent or this ajax snippet from SO I can request
/my-data.json
and it is fetched correctly.The text was updated successfully, but these errors were encountered: