forked from apollographql/apollo-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (41 loc) · 1.02 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
import sourcemaps from 'rollup-plugin-sourcemaps';
export const globals = {
// Apollo
'apollo-client': 'apollo.core',
'apollo-cache': 'apolloCache.core',
'apollo-link': 'apolloLink.core',
'apollo-link-dedup': 'apolloLink.dedup',
'apollo-utilities': 'apollo.utilities',
'graphql-anywhere': 'graphqlAnywhere',
};
export default (name, override = {}) => {
const config = Object.assign(
{
input: 'lib/index.js',
//output: merged separately
onwarn,
external: Object.keys(globals),
},
override,
);
config.output = Object.assign(
{
file: 'lib/bundle.umd.js',
format: 'umd',
name,
exports: 'named',
sourcemap: true,
globals,
},
config.output,
);
config.plugins = config.plugins || [];
config.plugins.push(sourcemaps());
return config;
};
function onwarn(message) {
const suppressed = ['UNRESOLVED_IMPORT', 'THIS_IS_UNDEFINED'];
if (!suppressed.find(code => message.code === code)) {
return console.warn(message.message);
}
}