I have a problem where loading a JavaScript library via CDN works, but serving it from my own server with bower doesn't. The following is a minimal example of what is happening (just a HTML file that can be opened directly):
Loading [email protected] from a CDN
<html>
<head>
<script src="https://jspm.io/[email protected]"></script>
</head>
<body></body>
</html>
If I open the Firefox Web Console and enter System, I get:
System
Object { normalize: f/e.normalize(), locate: m/e.locate(), fetch: c/e.fetch(), translate: d/e.translate(), instantiate: d/e.instantiate(), _loader: Object, baseURL: "file:///…", paths: Object, originalSystem: Object, noConflict: $__global.upgradeSystemLoader/p.noConflict(), 17 more… }
Loading [email protected] from a local directory
Then I downloaded the JavaScript file into the same directory as the HTML file and modified it to:
<html>
<head>
<script src="[email protected]"></script>
</head>
<body></body>
</html>
If I enter System in the console now, I get:
System
ReferenceError: System is not defined
I should add that window.upgradeSystemLoader is present, which is a function that is defined in the JavsScript library. So at least the file is being detected.
What is the difference? I am trying to serve System.js via bower from my own server, but I always end up in this situation: CDN works, local file doesn't.
--allow-file-access-from-filesflag@is a reserved URL character (ref.). So perhaps you have to encode it@as part of an attempt to authenticate. When it's buried further along the url as per the CDN, it seems it's ok, but nearer the start it's being parsed as auth info.system.js. I am following the angular 2 quick start from here, btw (scroll down to step 7).