I have noticed issues with using d3.request since moving my repository from D3 version 4.10.0 to version 4.10.2.
By examining my package-lock.json, I noticed one difference is that the former uses d3-request version 1.0.5 whereas the latter uses d3-request version 1.0.6.
The situation:
I am using browserify and http-server to prepare and serve my file respectively.
I have a file called index.html which I access via localhost:8080 when I'm building something.
I have a file called filelist.json which I can access via localhost:8080/filelist.json while I'm building.
I tried using d3.json() to access filelist.json from index.html and process the data.
Initially I used error and data arguments in the d3.json() callback to throw any errors and start working with the data. However, I got an Unexpected token T at character 0 error.
I removed the error throw and simply logged data in the console. This is when I saw that the T was the beginning of the line TypeError which was reporting that it could not access the file.
The problem seems to be that d3.json() was attempting to access my file from the address localhost:80filelist.json, instead of the full and correct address.
I tried this with other d3-request methods, like d3.tsv() and d3.request() itself. Same error thrown, albeit in slightly different guises depending on the function.
Since rolling back to D3 v4.10.0 I have not had this problem.
I have noticed issues with using
d3.request
since moving my repository from D3 version 4.10.0 to version 4.10.2.By examining my
package-lock.json
, I noticed one difference is that the former usesd3-request
version 1.0.5 whereas the latter uses d3-request version 1.0.6.The situation:
browserify
andhttp-server
to prepare and serve my file respectively.index.html
which I access vialocalhost:8080
when I'm building something.filelist.json
which I can access vialocalhost:8080/filelist.json
while I'm building.d3.json()
to accessfilelist.json
fromindex.html
and process the data.error
anddata
arguments in thed3.json()
callback to throw any errors and start working with the data. However, I got anUnexpected token T at character 0
error.T
was the beginning of the lineTypeError
which was reporting that it could not access the file.d3.json()
was attempting to access my file from the addresslocalhost:80filelist.json
, instead of the full and correct address.d3-request
methods, liked3.tsv()
andd3.request()
itself. Same error thrown, albeit in slightly different guises depending on the function.Since rolling back to D3 v4.10.0 I have not had this problem.