These are chat archives for systemjs/systemjs

1st
May 2018
Robin Deits
@rdeits
May 01 2018 01:25

Apologies in advance for what is probably a fairly dumb question, but I have a server (juliabox.com) from which I can successfully request JS resources by manually creating an XHR, like so:

var xhr = new XMLHttpRequest();
xhr.open('GET', 'pkg/WebIO/webio/dist/bundle.js', true);
xhr.withCredentials=true;
xhr.onload = (e) => console.log("response:", xhr.response);
xhr.send(null);

Based on https://github.com/systemjs/systemjs/issues/1403#issuecomment-239691607 I figured I would be able to use SystemJS to load the module with:

System.config({meta: {'*': {authorization: true}}});
System.import("pkg/WebIO/webio/dist/bundle.js").then(function(mod) {console.log(mod);});

but this fails with:

Error: NetworkError when attempting to fetch resource.
  Instantiating https://juliabox.com/notebook/pkg/WebIO/webio/dist/bundle.js
  Loading https://juliabox.com/notebook/pkg/WebIO/webio/dist/bundle.js

Am I missing something? I've read through https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#meta but couldn't figure out how to get System to match the behavior of my successful XHR.

In case anyone's curious, the fundamental issue I'm trying to solve is JuliaGizmos/WebIO.jl#96