sei-protocol/sei-js

[BUG] According to the first step of Javascript Reference, an error is reported

ahaocoder opened this issue · 2 comments

SeiJS package & version
"@sei-js/core": "^3.1.2",
"@sei-js/proto": "^3.1.0",
"@sei-js/react": "^3.2.0",

Describe the bug
According to the first step of Javascript Reference, an error is reported
npm install core/react/proto
ERROR in ./node_modules/@cosmjs/crypto/build/pbkdf2.js 50:67-84
Module not found: Error: Can't resolve 'crypto' in '/Users/ahao/WebstormProjects/sei-react/node_modules/@cosmjs/crypto/build'

The following are some screenshots:
image
image
image

Hey @ahaocoder, could you provide a small code snippet or a sample project that reproduces the issue? This will be helpful for us to see exactly what's going wrong. Also, which bundler are you using? The suggested bundler in our docs is Vite.

From the logs, it looks like you're using webpack (>5), which doesn't include the crypto polyfill by default. So, you'll likely need to add something like https://github.com/Richienb/node-polyfill-webpack-plugin

Closing for now. Feel free to reopen if you have more details!