Comments (2)
I am having this issue importing circomlibjs into .tsx/ .jsx files. Off the bat I was having multiple issues with webpack building, which I was able to resolve adding the following to my package.json:
...
"devDependencies": {
"assert": "npm:assert-browserify",
"crypto": "npm:crypto-browserify",
"fs": "npm:-@^0.0.1",
"os": "npm:os-browserify",
"path": "npm:path-browserify",
"stream": "npm:stream-browserify"
}
...
There is this repeating error left. For all files that import ethers using import ethers as "ethers"
this error throws during build process:
ERROR in ./node_modules/circomlibjs/src/poseidon_gencontract.js 139:32-56
export 'default' (imported as 'ethers') was not found in 'ethers' (possible exports: BaseContract, BigNumber, Contract, ContractFactory, FixedNumber, Signer, VoidSigner, Wallet, Wordlist, constants, errors, ethers, getDefaultProvider, logger, providers, utils, version, wordlists)
@ ./node_modules/circomlibjs/main.js 12:0-67 13:32-49
@ ./src/zk/index.ts 3:0-46 9:27-42
@ ./src/views/Game/index.tsx 11:0-32 127:10-20
@ ./src/Routes.tsx 8:0-30 20:32-36
@ ./src/App.tsx 4:0-28 10:35-41
@ ./src/index.tsx 7:0-24 11:33-36
Based on @connorbode 's juggestion I have set up the following postinstall.sh
:
#!/bin/bash
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/evmasm.js
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/mimcsponge.js
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/mimc7_gencontract.js
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/poseidon_gencontract.js
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/mimcsponge_gencontract.js
sed -i'' 's/import ethers as "ethers"/import { ethers } as "ethers"/g' ./node_modules/circomlibjs/src/mimc7.js
This results in a "successful" complilation, however webpack serves a blank page. Any input would be greatly appreciated
Edit: here is the offending repository of code: https://github.com/Ian-Bright/battlezip-frontend/tree/zk
from circomlibjs.
Having the same issue myself
from circomlibjs.
Related Issues (16)
- Error on eddsa.sign()
- Official way to transform the UInt8Array output of Poseidon into a BigInt? HOT 7
- Discrepancy between Poseidon hashes in circom vs circomlibjs HOT 4
- Poseidon hash has changed
- Why there is no Poseidon contract generator for arbitrary number of hash inputs? HOT 5
- Failed generate Poseidon smart contract with inputs > 6 HOT 2
- Error when attempting to use buildPoseidon HOT 1
- Correct method for calculating Pedersen hash HOT 3
- Error on import inside worker module HOT 1
- Question about prune in eddsa
- Question about eddsa + poseidon
- Something weird with F.toString
- Issue running in React.js (browser) HOT 4
- fix variable name in "eddsa.js: ensureBuffer"
- LICENSE missing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circomlibjs.