push-protocol / push-sdk

Push SDK is a growing Monorepo of packages that provide solutions for a wide range of development tasks one might come across while building on top of Push protocol. It is a Javascript-based group of packages that enables easy usage of imperative communication tools for Web3
Other
66 stars 49 forks source link

✏️ [Documentation] - Update required packages #1384

Open kinga112 opened 1 month ago

kinga112 commented 1 month ago

Expected Behaviour

The quick start docs say I need these packages for react: // Install Libraries npm install @pushprotocol/restapi@latest @pushprotocol/socket@latest ethers@^5.7

Here are the errors when only installing these:

ERROR in ./node_modules/@ethereumjs/util/node_modules/micro-ftch/index.js 54:17-32 Module not found: Error: Can't resolve 'http'

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:

ERROR in ./node_modules/@ethereumjs/util/node_modules/micro-ftch/index.js 55:18-34 Module not found: Error: Can't resolve 'https'

ERROR in ./node_modules/@ethereumjs/util/node_modules/micro-ftch/index.js 56:17-32 Module not found: Error: Can't resolve 'zlib'

ERROR in ./node_modules/@ethereumjs/util/node_modules/micro-ftch/index.js 58:36-50 Module not found: Error: Can't resolve 'url'

Current Behaviour

I cannot init user: const userAlice = await PushAPI.initialize(signer, { env: CONSTANTS.ENV.STAGING, });

Steps to Reproduce

Follow quick start docs: install packages and initialize user random ethers wallet.
kinga112 commented 1 month ago

It's a webpack issue, and I need to configure node externals for webpack.

kinga112 commented 1 month ago

I added this to my webpack config: resolve: { fallback: { "zlib": false, "http": false, "https": false, "crypto": false, "url": false, "crypto-browserify": require.resolve('crypto-browserify'), } },