forked from ethers-io/ethers.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup-tests.config.js
62 lines (52 loc) · 1.3 KB
/
rollup-tests.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
"use strict";
import commonjs from '@rollup/plugin-commonjs';
//import inject from '@rollup/plugin-inject';
import resolveNode from "@rollup/plugin-node-resolve";
import nodePolyfills from "rollup-plugin-node-polyfills";
import json from "@rollup/plugin-json";
function getConfig(format) {
// ESM config
let input = "./packages/tests/lib.esm/index.js";
let mainFields = undefined;
let globals = undefined;
if (format === "umd") {
input = "./packages/tests/lib/index.js";
mainFields = [ "browser", "main" ];
globals = { ethers: "ethers" };
}
const plugins = [
json(),
/*
inject({
modules: {
Buffer: [ "buffer", "Buffer" ],
},
include: "* * /test-utils.js"
}),
*/
commonjs({
}),
nodePolyfills({
assert: true
}),
resolveNode({ mainFields }),
];
return {
input: input,
output: {
file: ("./packages/tests/dist/tests." + format + ".js"),
name: "testing",
format,
globals
},
context: "window",
treeshake: false,
external: [ "ethers" ],
plugins: plugins
};
}
const configs = [
getConfig("umd"),
getConfig("esm"),
];
export default configs;