How to use System.js with CDN and local backup?

I launched jspm install angularand installed it locally in the jspm_packages folder.

From the code, I use regular ES6 imports, such as import angular from 'angular'.

What do I need to do to download angular from the CDN and return to the local version if the CDN is not available?

+4
source share
2 answers

You can have different files config.jsfor development and production, where products get angular from the CDN, and development gets them locally. However, there is currently no (as far as I know) way to get SystemJS to try one source, and then if that doesn't work with another source.

System.config({
    "map": {
        "jquery": "https://code.jquery.com/jquery-2.1.4.js"
    }
});
+8
source

angular:

/ angular.js

define(function() {
    return window.angular;
});

. , angular:

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.min.js"></script> systemjs code..

0

Source: https://habr.com/ru/post/1598866/


All Articles