11var isPublic = typeof window != "undefined" ;
22
3- /**
4- * System configuration for Angular 2 samples
5- * Adjust as necessary for your application needs.
6- */
7- ( function ( global ) {
8- System . config ( {
9- paths : {
10- // paths serve as alias
11- 'npm:' : ( isPublic ) ? 'node_modules/' : ''
12- } ,
13- // map tells the System loader where to look for things
14- map : {
15- // our app is within the app folder
16- app : 'app' ,
17- // angular bundles
18- '@angular/core' : 'npm:@angular/core/bundles/core.umd.js' ,
19- '@angular/common' : 'npm:@angular/common/bundles/common.umd.js' ,
20- '@angular/compiler' : 'npm:@angular/compiler/bundles/compiler.umd.js' ,
21- '@angular/platform-browser' : 'npm:@angular/platform-browser/bundles/platform-browser.umd.js' ,
22- '@angular/platform-browser-dynamic' : 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js' ,
23- '@angular/http' : 'npm:@angular/http/bundles/http.umd.js' ,
24- '@angular/router' : 'npm:@angular/router/bundles/router.umd.js' ,
25- '@angular/forms' : 'npm:@angular/forms/bundles/forms.umd.js' ,
26- // other libraries
27- 'rxjs' : 'npm:rxjs'
28- } ,
29- // packages tells the System loader how to load when no filename and/or no extension
30- packages : {
31- app : {
32- main : './main.js' ,
33- defaultExtension : 'js'
34- } ,
35- rxjs : {
36- defaultExtension : 'js'
37- }
38- }
39- } ) ;
3+ ( function ( global ) {
4+ // map tells the System loader where to look for things
5+ var map = {
6+ 'app' : 'app' , // 'dist',
7+ '@angular' : ( isPublic ) ? '@angular' : 'node_modules/@angular' ,
8+ 'rxjs' : ( isPublic ) ? 'rxjs' : 'node_modules/rxjs' ,
9+ } ;
10+ // packages tells the System loader how to load when no filename and/or no extension
11+ var packages = {
12+ 'app' : { main : 'main.js' , defaultExtension : 'js' } ,
13+ 'rxjs' : { defaultExtension : 'js' }
14+ } ;
15+ var ngPackageNames = [
16+ 'common' ,
17+ 'compiler' ,
18+ 'core' ,
19+ 'forms' ,
20+ 'http' ,
21+ 'platform-browser' ,
22+ 'platform-browser-dynamic' ,
23+ 'router' ,
24+ 'router-deprecated' ,
25+ 'upgrade' ,
26+ ] ;
27+ // Individual files (~300 requests):
28+ function packIndex ( pkgName ) {
29+ packages [ '@angular/' + pkgName ] = { main : 'index.js' , defaultExtension : 'js' } ;
30+ }
31+ // Bundled (~40 requests):
32+ function packUmd ( pkgName ) {
33+ packages [ '@angular/' + pkgName ] = { main : 'bundles/' + pkgName + '.umd.js' , defaultExtension : 'js' } ;
34+ }
35+ // Most environments should use UMD; some (Karma) need the individual index files
36+ var setPackageConfig = System . packageWithIndex ? packIndex : packUmd ;
37+ // Add package entries for angular packages
38+ ngPackageNames . forEach ( setPackageConfig ) ;
39+ var config = {
40+ map : map ,
41+ packages : packages
42+ } ;
43+ System . config ( config ) ;
4044} ) ( this ) ;
0 commit comments