forked from hashgraph/hethers.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup-ancillary.config.js
54 lines (45 loc) · 1.05 KB
/
rollup-ancillary.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
"use strict";
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import _globals from 'rollup-plugin-node-globals';
import { terser } from "rollup-plugin-terser";
function getConfig(project, minify) {
const suffix = ["esm"];
const plugins = [
resolve({
mainFields: ["browser", "module", "main"],
preferBuiltins: false
}),
commonjs({
namedExports: {
"bn.js": ["BN"],
"elliptic": ["ec"],
"scrypt-js": ["scrypt"],
"u2f-api": ["isSupported", "sign"],
"js-sha3": [null]
},
}),
_globals(),
];
if (minify) {
suffix.push("min");
plugins.push(terser());
}
return {
input: `packages/${project}/lib.esm/index.js`,
output: {
file: `packages/${project}/dist/hardware-wallets.${suffix.join(".")}.js`,
format: "esm",
name: "_ethersAncillary",
exports: "named"
},
context: "window",
treeshake: false,
plugins: plugins,
external: ['long', 'util', 'fs']
};
}
export default [
getConfig("hardware-wallets", false),
getConfig("hardware-wallets", true),
]