chore: update rollup patterns

This commit is contained in:
Blaine Bublitz 2021-02-09 21:42:05 -07:00
parent 4d1754ad7d
commit 1f85668137
4 changed files with 21 additions and 81 deletions

@ -1,5 +1,7 @@
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonJS from "@rollup/plugin-commonjs";
import fs from "fs";
import { builtinModules as builtin } from "module";
const pkg = JSON.parse(fs.readFileSync("./package.json"));
export default {
input: "main.js",
@ -8,26 +10,7 @@ export default {
format: "cjs",
},
external: [
"fs",
"os",
"worker_threads",
"readline",
"crypto",
"path",
"big-integer",
"wasmsnark",
"circom_runtime",
"blake2b-wasm",
"ffjavascript",
"keccak",
"yargs",
"logplease"
],
plugins: [
nodeResolve({ preferBuiltins: true }),
commonJS({
preserveSymlinks: true
}),
...Object.keys(pkg.dependencies),
...builtin,
]
};

@ -1,6 +1,7 @@
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonJS from "@rollup/plugin-commonjs";
import json from '@rollup/plugin-json';
import fs from "fs";
import { builtinModules as builtin } from "module";
const pkg = JSON.parse(fs.readFileSync("./package.json"));
export default {
input: "cli.js",
@ -10,31 +11,7 @@ export default {
banner: "#! /usr/bin/env node\n",
},
external: [
"fs",
"os",
"worker_threads",
"readline",
"crypto",
"path",
"big-integer",
"wasmsnark",
"circom_runtime",
"blake2b-wasm",
"ffjavascript",
"keccak",
"yargs",
"logplease",
],
plugins: [
nodeResolve({
preferBuiltins: true,
}),
commonJS({
preserveSymlinks: true,
include: "node_modules/**",
exclude: "node_modules/big-integer/**"
}),
json()
...Object.keys(pkg.dependencies),
...builtin,
]
};

@ -23,10 +23,11 @@ export default {
os: empty,
crypto: empty,
readline: empty,
worker_threads: empty,
}),
nodeResolve({
browser: true
browser: true,
preferBuiltins: false,
exportConditions: ['browser', 'default', 'module', 'require']
}),
commonJS(),
replace({

@ -1,36 +1,15 @@
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 config from './rollup.iife.config';
import { terser } from "rollup-plugin-terser";
const empty = 'export default {}';
export default {
input: "main.js",
...config,
output: {
...config.output,
file: "build/snarkjs.min.js",
format: "iife",
globals: {
os: "null"
},
name: "snarkjs"
sourcemap: false,
},
plugins: [
virtual({
fs: empty,
os: empty,
crypto: empty,
readline: empty,
worker_threads: empty,
}),
nodeResolve({
browser: true
}),
commonJS(),
replace({
"process.browser": !!process.env.BROWSER
}),
terser()
...config.plugins,
terser(),
]
};