forked from NG-ZORRO/ng-zorro-antd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
74 lines (68 loc) · 2.18 KB
/
rollup.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
65
66
67
68
69
70
71
72
73
74
import resolve from 'rollup-plugin-node-resolve'
import replace from 'rollup-plugin-replace'
const format = process.env.ROLLUP_FORMAT || 'es'
let globals = {
'@angular/animations': 'ng.animations',
'@angular/cdk': 'ng.cdk',
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'@angular/compiler': 'ng.compiler',
'@angular/forms': 'ng.forms',
'@angular/platform-browser': 'ng.platformBrowser',
'moment': 'moment',
'moment/locale/zh-cn': null,
'rxjs/BehaviorSubject': 'Rx',
'rxjs/Observable': 'Rx',
'rxjs/Subject': 'Rx',
'rxjs/Subscription': 'Rx',
'rxjs/observable/fromPromise': 'Rx.Observable',
'rxjs/observable/forkJoin': 'Rx.Observable',
'rxjs/observable/fromEvent': 'Rx.Observable',
'rxjs/observable/merge': 'Rx.Observable',
'rxjs/observable/of': 'Rx.Observable',
'rxjs/operator/auditTime': 'Rx.Observable.prototype',
'rxjs/operator/catch': 'Rx.Observable.prototype',
'rxjs/operator/debounceTime': 'Rx.Observable.prototype',
'rxjs/operator/distinctUntilChanged': 'Rx.Observable.prototype',
'rxjs/operator/do': 'Rx.Observable.prototype',
'rxjs/operator/filter': 'Rx.Observable.prototype',
'rxjs/operator/finally': 'Rx.Observable.prototype',
'rxjs/operator/first': 'Rx.Observable.prototype',
'rxjs/operator/map': 'Rx.Observable.prototype',
'rxjs/operator/pluck': 'Rx.Observable.prototype',
'rxjs/operator/startWith': 'Rx.Observable.prototype',
'rxjs/operator/switchMap': 'Rx.Observable.prototype',
'rxjs/operator/takeUntil': 'Rx.Observable.prototype',
'rxjs/operator/throttleTime': 'Rx.Observable.prototype',
}
if (format === 'es') {
globals = Object.assign(globals, {
'tslib': 'tslib',
})
}
let input
let file
switch (format) {
case 'es':
input = './publish/src/index.js'
file = './publish/esm15/index.js'
break
case 'umd':
input = './publish/esm5/index.js'
file = './publish/bundles/ng-zorro-antd.umd.js'
break
default:
throw new Error(`format ${format} is not supported`)
}
export default {
input,
output: {
file,
format,
},
exports: 'named',
name: 'ngZorro.antd',
plugins: [replace({ "import * as moment": "import moment" }), resolve()],
external: Object.keys(globals),
globals,
}