-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
65 lines (55 loc) · 1.22 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
import typescript from 'rollup-plugin-typescript2'
const { compilerOptions } = require('./tsconfig.json')
const createConfig = tsOptions => options => {
const override = Object.assign({}, compilerOptions, tsOptions)
return Object.assign({
plugins: [
typescript({
tsconfigOverride: { compilerOptions: override },
useTsconfigDeclarationDir: true
})
],
external: ['crypto']
}, options)
}
const createCommonConfig = createConfig({
moduleResolution: "node",
})
const cloudCommon = createCommonConfig({
input: 'cloud/index.ts',
output: {
file: 'cloud/build.js',
format: 'cjs'
}
})
const cloudES = createConfig({})({
input: 'cloud/index.ts',
output: {
file: 'cloud/build_es.js',
format: 'es'
}
})
// No need to make an ES bundle for Macs as they cannot be used in the browser
const macCommon = createCommonConfig({
input: 'mac/index.ts',
output: {
file: 'mac/build.js',
format: 'cjs'
},
external: [
'fs', 'zlib', 'util', 'child_process'
]
})
const interfaceConfig = createConfig({})({
input: 'api/index.ts',
output: {
file: 'api/build.js',
format: 'cjs'
}
})
export default [
cloudCommon,
cloudES,
macCommon,
interfaceConfig
]