In an HTML script, a call to fetch a package ending in vega@n
where n
is a version number, is being incorrectly expanded and causing a 404 error. I'm trying to find out why, and to prevent this.
Apologies in advance for the long-winded explanation, but I'm not sure where the problem lies so I'm trying to be as specific as possible.
I'm following the user guide to try and load a vis into a jupyter notebook. This executes the script in-browser, I believe, but for some reason has support for requireJS
, which means that global modules aren't correctly loaded when using the import method, which basically uses html's <script>
tags to load the module.
This can be worked around by calling define
, as described in a similar problem with D3, here: https://github.com/mpld3/mpld3/issues/33#issuecomment-32101013.
I've written this gist to show a working example:
https://gist.github.com/lJoublanc/439e2f687b7aedd6fbdea5adab5cee0f
However, for some reason (either requireJS
or something else - my JS knowledge is limited), expands URLs of the form https://cdn.jsdelivr.net/npm/vega@3
into something like https://cdn.jsdelivr.net/npm/vega@3.js?v=20180324103700
which results in a 404 error.
Using the github URL (i.e. without the @3
) works fine though.
Any idea if this is requireJS
doing this, or the CDN? How would I work around it?