-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.js
56 lines (49 loc) · 1.18 KB
/
rollup.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
const autoExternal = require('rollup-plugin-auto-external');
const commonjs = require('rollup-plugin-commonjs');
const json = require('rollup-plugin-json');
const typescript = require('rollup-plugin-typescript2');
const pkg = require('./package');
const rollup = require('rollup');
// Input
// --------------------------
const input = {
input: 'src/Db.ts',
external: [
'rxjs',
'rxjs/operators'
],
plugins: [
autoExternal(),
commonjs(),
json(),
typescript({
typescript: require('typescript'),
clean: true,
exclude: ['tests/*.ts', '__tests__/*.ts', 'temp/*.ts', 'examples/**/*.js', 'examples/**/*.ts']
}),
],
};
// Output
// --------------------------
const output = {
cjs: {
file: pkg.main,
format: 'cjs',
},
es: {
file: pkg.module,
format: 'es',
}
};
// Build
// --------------------------
async function build() {
const bundle = await rollup.rollup(input);
for (let prop in output) {
console.log("building: " + prop);
await bundle.write(output[prop]);
}
}
// Actually call build
// --------------------------
build();