Skip to content

Instantly share code, notes, and snippets.

@abhilive
Created December 20, 2016 13:40
Show Gist options
  • Save abhilive/973cd09ca089e34ae2c147dde9f09169 to your computer and use it in GitHub Desktop.
Save abhilive/973cd09ca089e34ae2c147dde9f09169 to your computer and use it in GitHub Desktop.
var isPublic = typeof window != "undefined";
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'@angular': (isPublic)? '@angular' : 'node_modules/@angular',
'rxjs': (isPublic)? 'rxjs' : 'node_modules/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'material',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade'
];
// Individual files (~300 requests):
function packIndex(pkgName) {
packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
}
// Bundled (~40 requests):
function packUmd(pkgName) {
packages['@angular/'+pkgName] = { main: 'bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
}
// Most environments should use UMD; some (Karma) need the individual index files
var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
// Add package entries for angular packages
ngPackageNames.forEach(setPackageConfig);
var config = {
map: map,
packages: packages
};
System.config(config);
})(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment