|
3 | 3 | * Adjust as necessary for your application needs.
|
4 | 4 | */
|
5 | 5 | (function (global) {
|
6 |
| - // map tells the System loader where to look for things |
7 |
| - var map = { |
8 |
| - 'app': 'app', // 'dist', |
9 |
| - '@angular': 'node_modules/@angular', |
10 |
| - 'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api', |
11 |
| - 'rxjs': 'node_modules/rxjs' |
12 |
| - }; |
13 |
| - // packages tells the System loader how to load when no filename and/or no extension |
14 |
| - var packages = { |
15 |
| - 'app': { main: 'main.js', defaultExtension: 'js' }, |
16 |
| - 'rxjs': { defaultExtension: 'js' }, |
17 |
| - 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, |
18 |
| - }; |
19 |
| - var ngPackageNames = [ |
20 |
| - 'common', |
21 |
| - 'compiler', |
22 |
| - 'core', |
23 |
| - 'forms', |
24 |
| - 'http', |
25 |
| - 'platform-browser', |
26 |
| - 'platform-browser-dynamic', |
27 |
| - 'router', |
28 |
| - 'router-deprecated', |
29 |
| - 'upgrade', |
30 |
| - ]; |
31 |
| - // Individual files (~300 requests): |
32 |
| - function packIndex(pkgName) { |
33 |
| - packages['@angular/' + pkgName] = { main: 'index.js', defaultExtension: 'js' }; |
34 |
| - } |
35 |
| - // Bundled (~40 requests): |
36 |
| - function packUmd(pkgName) { |
37 |
| - packages['@angular/' + pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' }; |
38 |
| - } |
39 |
| - |
40 |
| - // Most environments should use UMD; some (Karma) need the individual index files |
41 |
| - // var setPackageConfig = System.packageWithIndex ? packIndex : packUmd; |
42 |
| - // use packIndex as workaround for bug with MockBackend.createConnection method - https://github.com/angular/angular/issues/9170#issuecomment-225708113 |
43 |
| - var setPackageConfig = packIndex; |
44 |
| - |
45 |
| - // Add package entries for angular packages |
46 |
| - ngPackageNames.forEach(setPackageConfig); |
47 |
| - var config = { |
48 |
| - map: map, |
49 |
| - packages: packages |
50 |
| - }; |
51 |
| - System.config(config); |
| 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 | + // angular bundles |
| 16 | + '@angular/core': 'npm:@angular/core/bundles/core.umd.js', |
| 17 | + '@angular/common': 'npm:@angular/common/bundles/common.umd.js', |
| 18 | + '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', |
| 19 | + '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', |
| 20 | + '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', |
| 21 | + '@angular/http': 'npm:@angular/http/bundles/http.umd.js', |
| 22 | + '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js', |
| 23 | + '@angular/router': 'npm:@angular/router/bundles/router.umd.js', |
| 24 | + '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', |
| 25 | + // other libraries |
| 26 | + 'rxjs': 'npm:rxjs', |
| 27 | + 'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api', |
| 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 | + 'angular2-in-memory-web-api': { |
| 39 | + main: './index.js', |
| 40 | + defaultExtension: 'js' |
| 41 | + } |
| 42 | + } |
| 43 | + }); |
52 | 44 | })(this);
|
0 commit comments