zk-merkle-tree
zk-merkle-tree copied to clipboard
React JS incompatible
I want to use this library with React (and Next.JS). But I got error:
Module not found: Error: Can't resolve 'fs'
Steps to reproduce:
- Create fresh React app:
yarn create react-app my-app --template typescript
- Add zk-merkle-tree dependency
yarn add zk-merkle-tree
- Import zk-merkle-tree in
src/App.tsx
:import {generateCommitment} from "zk-merkle-tree"
- Call generateCommitment:
useEffect(() => {
generateCommitment().then()
}, [])
src/App.tsx full file example
5. Start project yarn start
6. Get errors:
ERROR in ./node_modules/ejs/lib/ejs.js 46:9-22 Module not found: Error: Can't resolve 'fs' in '<...>/node_modules/ejs/lib' And much more, here is full error message