-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-config.ts
74 lines (61 loc) · 2.21 KB
/
system-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
'app' : 'app',
'main': 'app/main.js',
'@angular' : 'node_modules/@angular',
'angular2-in-memory-web-api' : 'node_modules/angular2-in-memory-web-api',
'rxjs' : 'node_modules/rxjs',
'angular2-jwt': 'node_modules/angular2-jwt/angular2-jwt.js'
};
// packages tells the System loader how to load when no filename and/or no
// extension
const packages: any = {
'app' : {main : 'main.js', defaultExtension : 'js'},
'api' : {defaultExtension : 'js'},
'rxjs' : {defaultExtension : 'js'},
'angular2-in-memory-web-api' : {main : 'index.js', defaultExtension : 'js'}
};
const barrels: any = [
// App specific barrels.
'app/routing',
'app/shared',
'app/models',
];
barrels.forEach((barrelName: string) => {
packages[barrelName] = { main: 'index' };
});
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const ngPackageNames: string[] = [
'common',
'compiler',
'core',
'forms',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Individual files (~300 requests):
function packIndex(pkgName: string) {
packages['@angular/' + pkgName] = {main : 'index.js', defaultExtension : 'js'};
}
// Bundled (~40 requests):
function packUmd(pkgName: string) {
packages['@angular/' + pkgName] = {main : '/bundles/' + pkgName + '.umd.js',defaultExtension : 'js'};
}
declare var System: any;
// 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);