forked from kamilkisiela/apollo-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
44 lines (40 loc) · 1.17 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
const genName = name => `apollo.${name}`;
export const globals = {
// Angular
'@angular/core': 'ng.core',
'@angular/common/http': 'ng.common.http',
'@ngrx/store': 'ngrx.store',
// Apollo
'apollo-link': 'httpLink',
'apollo-client-rxjs': 'apollo.rxjs',
'apollo-client': 'apollo',
'apollo-angular-link-http-common': genName('link.httpCommon'),
'apollo-link-context': 'apolloLink.context',
'apollo-link-persisted-queries': 'persistedQueryLink',
// RxJS
'rxjs/Observable': 'Rx',
'rxjs/observable/from': 'Rx.Observable',
'rxjs/observable/fromPromise': 'Rx.Observable',
'rxjs/scheduler/queue': 'Rx.Scheduler',
'rxjs/operator/observeOn': 'Rx.Observable.prototype',
'rxjs/operator/take': 'Rx.Observable.prototype',
};
export default name => ({
input: 'build/src/index.js',
output: {
file: 'build/bundle.umd.js',
format: 'umd',
},
name: genName(name),
exports: 'named',
sourcemap: true,
external: Object.keys(globals),
onwarn,
globals,
});
function onwarn(message) {
const suppressed = ['UNRESOLVED_IMPORT', 'THIS_IS_UNDEFINED'];
if (!suppressed.find(code => message.code === code)) {
return console.warn(message.message);
}
}