Open kinga112 opened 1 month ago
It's a webpack issue, and I need to configure node externals for webpack.
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'), } },
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