forked from iden3/snarkjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.iife.config.js
55 lines (53 loc) · 1.57 KB
/
rollup.iife.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
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonJS from "@rollup/plugin-commonjs";
import virtual from "@rollup/plugin-virtual";
import replace from "@rollup/plugin-replace";
import visualizer from "rollup-plugin-visualizer";
// Needed by fastfile
import { O_TRUNC, O_CREAT, O_RDWR, O_EXCL, O_RDONLY } from "constants";
const empty = "export default {}";
// We create a stub with these constants instead of including the entire constants definition
const constants = `
export const O_TRUNC = ${O_TRUNC};
export const O_CREAT = ${O_CREAT};
export const O_RDWR = ${O_RDWR};
export const O_EXCL = ${O_EXCL};
export const O_RDONLY = ${O_RDONLY}
`;
export default {
input: "main.js",
output: {
file: "build/snarkjs.js",
format: "iife",
sourcemap: "inline",
globals: {
os: "null"
},
name: "snarkjs"
},
plugins: [
virtual({
fs: empty,
os: empty,
crypto: empty,
readline: empty,
ejs: empty,
events: empty,
stream: empty,
util: empty,
constants: constants,
}),
nodeResolve({
browser: true,
preferBuiltins: false,
exportConditions: ["browser", "default", "module", "require"]
}),
commonJS(),
replace({
// The current default is false, but they are changing it next version
preventAssignment: false,
"process.browser": !!process.env.BROWSER
}),
visualizer(),
]
};