-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Browser ES module build #127
Conversation
A browser bundle is unnecessary here. Perhaps you want to remove |
Hello!
Could you please explain in more detail why you have concerns about not having a browser bundle? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A browser bundle is not required. Node 20+ has the global Crypto
API, so we should remove the process.browser
usage and remove any node-specific imports.
Browser bundle is built anyway in SnarkJS, this PR simplifies life for people using ffjavascript directly in the browser, and unblocks creation of SnarkJS build that works fine with Angular and other frontend frameworks. Nodejs compatibility with the browser crypto api is nice, but wasn't in the scope of this PR. And |
Add Browser ES module build
Why?
snarkjs
package in our project https://github.com/0xPolygonID/js-sdk and faced with issue that ES build for browser is not working. It works fine withsnarkjs
bundle for browser, but there are some disadvantages:window
objectAdvantages of using ES module build:
npm i ffjavascript
and you can easily use it for example in Angular or ReactWhat is changed?
browser.esm.js
in case of browser usageWhat is next
snarkjs
package in similar way Add Browser ES module build #127UDP: in theory issue #29 should be fixed by this PR