Reputation: 2831
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):
<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… }
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.
Upvotes: 0
Views: 750
Reputation: 460
Something is missing [email protected]
i think systemJs helps you load that js file. If you check your console. you would find that that es6-module is missing.
In the system file it requires this src="'+basePath+'[email protected]
You can either download it or change the path in the systemJs source file
You could download it here es6-modules
Upvotes: 2