Skip to content

Instantly share code, notes, and snippets.

@enginer
Last active April 14, 2023 13:32
Show Gist options
  • Save enginer/be24e10fb0630c5fe974d2f1c774bbf6 to your computer and use it in GitHub Desktop.
Save enginer/be24e10fb0630c5fe974d2f1c774bbf6 to your computer and use it in GitHub Desktop.
React + zk-merkle-tree issue
Compiled with problems:
ERROR in ./node_modules/ejs/lib/ejs.js 46:9-22
Module not found: Error: Can't resolve 'fs' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/ejs/lib'
ERROR in ./node_modules/ejs/lib/ejs.js 47:11-26
Module not found: Error: Can't resolve 'path' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/ejs/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
ERROR in ./node_modules/readable-stream/lib/_stream_readable.js 43:13-37
Module not found: Error: Can't resolve 'buffer' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/readable-stream/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "buffer": false }
ERROR in ./node_modules/readable-stream/lib/_stream_writable.js 66:13-37
Module not found: Error: Can't resolve 'buffer' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/readable-stream/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "buffer": false }
ERROR in ./node_modules/readable-stream/lib/internal/streams/buffer_list.js 74:15-32
Module not found: Error: Can't resolve 'buffer' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/readable-stream/lib/internal/streams'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "buffer": false }
ERROR in ./node_modules/safe-buffer/index.js 3:13-30
Module not found: Error: Can't resolve 'buffer' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/safe-buffer'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "buffer": false }
ERROR in ./node_modules/zk-merkle-tree/dist/module.js 1:0-59
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/zk-merkle-tree/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/zk-merkle-tree/dist/module.js 5:0-49
Module not found: Error: Can't resolve 'buffer' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/zk-merkle-tree/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "buffer": require.resolve("buffer/") }'
- install 'buffer'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "buffer": false }
ERROR in ./node_modules/@iden3/binfileutils/node_modules/ffjavascript/src/random.js 2:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/@iden3/binfileutils/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/@iden3/binfileutils/node_modules/ffjavascript/src/threadman.js 25:0-20
Module not found: Error: Can't resolve 'os' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/@iden3/binfileutils/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/circomlibjs/node_modules/ffjavascript/src/random.js 2:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/circomlibjs/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/circomlibjs/node_modules/ffjavascript/src/threadman.js 25:0-20
Module not found: Error: Can't resolve 'os' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/circomlibjs/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/circomlibjs/src/poseidon_opt.js 10:0-28
Module not found: Error: Can't resolve 'assert' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/circomlibjs/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/circomlibjs/src/poseidon_reference.js 1:0-28
Module not found: Error: Can't resolve 'assert' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/circomlibjs/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
- install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "assert": false }
ERROR in ./node_modules/fastfile/src/fastfile.js 5:0-71
Module not found: Error: Can't resolve 'constants' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/fastfile/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "constants": require.resolve("constants-browserify") }'
- install 'constants-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "constants": false }
ERROR in ./node_modules/fastfile/src/osfile.js 1:0-20
Module not found: Error: Can't resolve 'fs' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/fastfile/src'
ERROR in ./node_modules/ffjavascript/src/random.js 2:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ffjavascript/src/threadman.js 25:0-20
Module not found: Error: Can't resolve 'os' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/ffjavascript/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/snarkjs/src/misc.js 22:0-32
Module not found: Error: Can't resolve 'readline' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/snarkjs/src'
ERROR in ./node_modules/snarkjs/src/misc.js 24:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/snarkjs/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/snarkjs/src/powersoftau_verify.js 23:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/snarkjs/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
ERROR in ./node_modules/snarkjs/src/zkey_verify_frominit.js 27:0-28
Module not found: Error: Can't resolve 'crypto' in '/Users/yurii/projects/trustless-voting/trustless-voting-poc/node_modules/snarkjs/src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
import React, {useEffect} from 'react';
import logo from './logo.svg';
import './App.css';
import {generateCommitment} from "zk-merkle-tree";
function App() {
useEffect(() => {
generateCommitment().then()
}, [])
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment