forked from ethers-io/ethers.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (42 loc) · 1.08 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 { nodeResolve } from '@rollup/plugin-node-resolve';
function getConfig(opts) {
if (opts == null) { opts = { }; }
const file = `./dist/ethers${ (opts.suffix || "") }.js`;
const exportConditions = [ "default", "module", "import" ];
const mainFields = [ "module", "main" ];
if (opts.browser) { mainFields.unshift("browser"); }
return {
input: "./lib.esm/index.js",
output: {
file,
format: "esm",
sourcemap: true
},
context: "window",
treeshake: false,
plugins: [ nodeResolve({
exportConditions,
mainFields,
modulesOnly: true,
preferBuiltins: false
}) ],
};
}
export default [
getConfig({ browser: true }),
{
input: "./lib.esm/wordlists/wordlists-extra.js",
output: {
file: "./dist/wordlists-extra.js",
format: "esm",
sourcemap: true
},
treeshake: true,
plugins: [ nodeResolve({
exportConditions: [ "default", "module", "import" ],
mainFields: [ "browser", "module", "main" ],
modulesOnly: true,
preferBuiltins: false
}) ],
}
];