Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created January 24, 2017 01:42
Show Gist options
  • Save unicodeveloper/81f54a8dd1046b13124a9217d553615f to your computer and use it in GitHub Desktop.
Save unicodeveloper/81f54a8dd1046b13124a9217d553615f to your computer and use it in GitHub Desktop.
Updated systemjs.config.js to look for Cloudinary packages
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function(global) {
// map tells the System loader where to look for things
var map = {
'app': 'dist', // 'dist',
'@angular': 'node_modules/@angular',
'@cloudinary/angular': 'node_modules/@cloudinary/angular',
'cloudinary-core': 'node_modules/cloudinary-core',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs',
'ng2-file-upload': 'node_modules/ng2-file-upload'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'@cloudinary/angular': { main: 'index.js', defaultExtension: 'js' },
'ng2-file-upload': { main: 'ng2-file-upload.js', defaultExtension: 'js' },
'cloudinary-core': { main: 'cloudinary-core-shrinkwrap.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },
};
var ngPackageNames = [
'common',
'compiler',
'core',
'forms',
'http',
'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