Merge pull request #84 from phated/rollup-cleanup

chore: update rollup patterns
This commit is contained in:
Jordi Baylina 2021-02-10 09:48:50 +01:00 committed by GitHub
commit 9a71b7d756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(),
]
};