I've got following set up in my index.html:
...
<script src="components/angular/angular.js"></script>
<script src="components/traceur/traceur.js"></script>
<script src="components/es6-module-loader/dist/es6-module-loader.src.js"></script>
<script src="components/system.js/dist/system.src.js"></script>
<script>
System.baseURL = '/';
</script>
<script type="module">
// Example
import angular from 'angular';
angular.module('myApp', [...]);
</script>
I'd like to load angular.js (and some other common libs) globally via script tag. But when I'm trying to use it in modules (in my case, es6-modules) system.js tries to load it via URL http://mysite/angular.js
. It just doesn't see that I've already included it as global lib. I spent several hours figuring out how can I handle this, read system.js wiki on Github, but I'm still stuck with this.
Can anybody show how to configure system.js to work with global libs?
System.registerDynamic('angular', [], false, function(require, exports, module) {
module.exports = window.angular;
});
or
System.set('angular', System.newModule({
"default": window.angular
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With