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