-
Notifications
You must be signed in to change notification settings - Fork 9
/
system.config.js
64 lines (56 loc) · 2.02 KB
/
system.config.js
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
console.log('Using global system config (loaded from /system.config.js)');
var RUNTIME_FILE = 'bootstrap.runtime.ts';
var AOT_FILE = 'bootstrap.aot.ts';
function parseQS(searchStr) {
var values = {};
searchStr.split('&').forEach(function(token) {
var tuple = token.split('=');
values[tuple[0]] = tuple[1] || true;
});
return values;
}
var searchValue = window.location.search;
var qsValues = parseQS(searchValue.length ? searchValue.substr(1) : "");
var mainFile = RUNTIME_FILE;
var href = window.location.href;
if (qsValues.aot) {
mainFile = AOT_FILE;
}
var mappings = {
index: '.',
'@angular': './@angular',
'rxjs': 'https://npmcdn.com/[email protected]'
};
var packages = {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/compiler': {main: 'index.js', defaultExtension: 'js'},
'@angular/router': {main: 'index.js', defaultExtension: 'js'},
'@angular/common': {main: 'index.js', defaultExtension: 'js'},
'@angular/forms': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser': {main: 'index.js', defaultExtension: 'js'},
'@angular/platform-browser-dynamic': {main: 'index.js', defaultExtension: 'js'},
rxjs: {
defaultExtension: 'js'
},
index: {
main: mainFile,
defaultExtension: 'ts'
}
};
if (qsValues.bundle) {
packages['@angular/core']['main'] = 'bundles/core.umd.js';
packages['@angular/compiler']['main'] = 'bundles/compiler.umd.js';
packages['@angular/router']['main'] = 'bundles/router.umd.js';
packages['@angular/common']['main'] = 'bundles/common.umd.js';
packages['@angular/forms']['main'] = 'bundles/forms.umd.js';
packages['@angular/platform-browser']['main'] = 'bundles/platform-browser.umd.js';
packages['@angular/platform-browser-dynamic']['main'] = 'bundles/platform-browser-dynamic.umd.js';
}
System.config({
transpiler: 'typescript',
typescriptOptions: {
emitDecoratorMetadata: true
},
map: mappings,
packages: packages
});