-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.ts
83 lines (80 loc) · 2.41 KB
/
rollup.config.ts
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
75
76
77
78
79
80
81
82
83
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
// import nodePolyfills from 'rollup-plugin-polyfill-node';
import nodeResolve from '@rollup/plugin-node-resolve';
const name = 'dhive-sl';
const bundle = (config) => ({
...config,
input: 'src/index.ts',
external: (id) => !/^[./]/.test(id),
});
export default [
bundle({
plugins: [nodeResolve(), esbuild({ minify: true })],
output: [
{
file: `dist/${name}.js`,
format: 'cjs',
sourcemap: true,
},
{
file: `dist/${name}.esm.js`,
format: 'es',
sourcemap: true,
},
],
}),
// // TODO: Not yet fully working with polyfills
// bundle({
// external: ['buffer'],
// plugins: [
// nodePolyfills({
// include: ['buffer', 'stream', 'events', 'assert'],
// }),
// nodeResolve({
// browser: true,
// preferBuiltins: false,
// }),
// ,
// esbuild({ minify: false }),
// ],
// output: [
// {
// name: 'dhiveSL',
// file: `dist/${name}.esm.browser.js`,
// format: 'es',
// sourcemap: true,
// },
// {
// name: 'dhiveSL',
// file: `dist/${name}.umd.js`,
// format: 'umd',
// sourcemap: true,
// globals: {
// buffer: '_buffer',
// stream: 'stream',
// bytebuffer: 'bytebuffer',
// assert: 'assert',
// crypto: 'crypto',
// secp256k1: 'secp256k1',
// bs58: 'bs58',
// ecurve: 'ecurve',
// bigi: 'bigi',
// jsbi: 'jsbi',
// fs: 'fs',
// verror: 'verror',
// 'secure-random': 'secureRandom',
// 'browserify-aes': 'browserifyAes',
// 'cross-fetch': 'crossFetch',
// },
// },
// ],
// }),
bundle({
plugins: [dts()],
output: {
file: `dist/${name}.d.ts`,
format: 'es',
},
}),
];