2021-01-17 00:49:52 +03:00
|
|
|
import { nodeResolve } from "@rollup/plugin-node-resolve";
|
|
|
|
import commonJS from "@rollup/plugin-commonjs";
|
2021-02-11 03:47:48 +03:00
|
|
|
import inject from "@rollup/plugin-inject";
|
2021-01-18 00:49:21 +03:00
|
|
|
import virtual from "@rollup/plugin-virtual";
|
|
|
|
import replace from "@rollup/plugin-replace";
|
|
|
|
import visualizer from "rollup-plugin-visualizer";
|
2021-01-17 00:49:52 +03:00
|
|
|
|
2021-01-18 00:49:21 +03:00
|
|
|
const empty = "export default {}";
|
2020-07-11 11:31:52 +03:00
|
|
|
|
|
|
|
export default {
|
|
|
|
input: "main.js",
|
|
|
|
output: {
|
|
|
|
file: "build/snarkjs.js",
|
|
|
|
format: "iife",
|
|
|
|
sourcemap: "inline",
|
|
|
|
globals: {
|
|
|
|
os: "null"
|
|
|
|
},
|
|
|
|
name: "snarkjs"
|
|
|
|
},
|
|
|
|
plugins: [
|
2021-01-17 00:49:52 +03:00
|
|
|
virtual({
|
|
|
|
fs: empty,
|
|
|
|
os: empty,
|
|
|
|
crypto: empty,
|
|
|
|
readline: empty,
|
2021-05-31 14:21:07 +03:00
|
|
|
ejs: empty,
|
2021-02-11 03:47:48 +03:00
|
|
|
// Stub out a "global" module that we can inject later
|
|
|
|
global: empty,
|
2021-01-17 00:49:52 +03:00
|
|
|
}),
|
2021-01-18 01:20:07 +03:00
|
|
|
nodeResolve({
|
2021-02-10 07:42:05 +03:00
|
|
|
browser: true,
|
|
|
|
preferBuiltins: false,
|
|
|
|
exportConditions: ['browser', 'default', 'module', 'require']
|
2021-01-18 01:20:07 +03:00
|
|
|
}),
|
2020-07-11 11:31:52 +03:00
|
|
|
commonJS(),
|
2021-01-18 01:20:07 +03:00
|
|
|
replace({
|
|
|
|
"process.browser": !!process.env.BROWSER
|
|
|
|
}),
|
2021-02-11 03:47:48 +03:00
|
|
|
inject({
|
|
|
|
// Inject the "global" virtual module if we see any reference to `global` in the code
|
|
|
|
global: "global",
|
|
|
|
}),
|
2021-01-18 00:49:21 +03:00
|
|
|
visualizer(),
|
2020-07-11 11:31:52 +03:00
|
|
|
]
|
|
|
|
};
|