I'm using the Aurelia CLI for a data visualization project and can successfully import .json data files from within my src/ directory with
d3.json('src/data/patient-data.json', (data:JSON) => { ... }
when running with "au run" and pointing the browser to localhost:9000.
However, if I open my index.html file statically within a browser, everything else on the page works just fine, except my data won't load and I get the error:
XMLHttpRequest cannot load file:///D:/Webstorm%20Projects/ag-grid-aurelia-example-master/src/data/patient-data.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
How can I fix this? And why is it a cross origin request when the file is coming from within my own src directory?
I don't understand why it works fine with 'au run' but not when opened directly from index.html. Does it have something to do with the json file not being included in the bundling process?
And while I'm already using d3 for other things, I'm not necessarily tied to using it to import json files specifically, if that has anything to do with the problem. I just need to load them in somehow.