|
1 |
| -const barrels: string[] = [ |
| 1 | +/*********************************************************************************************** |
| 2 | + * User Configuration. |
| 3 | + **********************************************************************************************/ |
| 4 | +/** Map relative paths to URLs. */ |
| 5 | +const map: any = { |
| 6 | +}; |
| 7 | + |
| 8 | +/** User packages configuration. */ |
| 9 | +const packages: any = { |
| 10 | +}; |
| 11 | + |
| 12 | +//////////////////////////////////////////////////////////////////////////////////////////////// |
| 13 | +/*********************************************************************************************** |
| 14 | + * Everything underneath this line is managed by the CLI. |
| 15 | + **********************************************************************************************/ |
| 16 | +const barrels = [ |
| 17 | + // Angular specific barrels. |
| 18 | + '@angular/core', |
| 19 | + '@angular/common', |
| 20 | + '@angular/compiler', |
| 21 | + '@angular/http', |
| 22 | + '@angular/router', |
| 23 | + '@angular/platform-browser', |
| 24 | + '@angular/platform-browser-dynamic', |
| 25 | + |
| 26 | + // Thirdparty barrels. |
| 27 | + 'rxjs', |
| 28 | + |
| 29 | + // App specific barrels. |
2 | 30 | 'app',
|
3 | 31 | 'app/shared',
|
4 | 32 | /** @cli-barrel */
|
5 | 33 | ];
|
6 | 34 |
|
7 |
| -function createPackageConfig(barrelList: string[]): any { |
8 |
| - return barrelList.reduce((barrelConfig: any, barrelName: string) => { |
9 |
| - barrelConfig[barrelName] = { |
| 35 | +const _cliSystemConfig = {}; |
| 36 | +barrels.forEach((barrelName: string) => { |
| 37 | + _cliSystemConfig[barrelName] = { main: 'index' }; |
10 | 38 | format: 'register',
|
11 | 39 | defaultExtension: 'js',
|
12 | 40 | main: 'index'
|
13 | 41 | };
|
14 | 42 | return barrelConfig;
|
15 |
| - }, {}); |
16 |
| -} |
| 43 | +}); |
17 | 44 |
|
| 45 | +/** Type declaration for ambient System. */ |
| 46 | +declare var System: any; |
18 | 47 |
|
19 |
| -// Add your custom SystemJS configuration here. |
20 |
| -export const config: any = { |
21 |
| - packages: Object.assign({ |
22 |
| - // Add your custom SystemJS packages here. |
23 |
| - }, createPackageConfig(barrels)) |
24 |
| -}; |
| 48 | +// Apply the CLI SystemJS configuration. |
| 49 | +System.config({ |
| 50 | + map: { |
| 51 | + '@angular': 'vendor/@angular', |
| 52 | + 'rxjs': 'vendor/rxjs', |
| 53 | + 'main': 'main.js' |
| 54 | + }, |
| 55 | + packages: _cliSystemConfig |
| 56 | +}); |
| 57 | + |
| 58 | +// Apply the user's configuration. |
| 59 | +System.config({ map, packages }); |
0 commit comments