[SOLVED] BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default

Hi I’m trying to use react-moralis

I do:

npx create-react-app my-app
cd my-app
npm install react react-dom moralis react-moralis

Then I added into the index.js
import { MoralisProvider } from "react-moralis";

I run npm start

Now I got this bunch of errors. How to fix this?

Failed to compile.

Module not found: Error: Can't resolve 'stream' in '/home/brian/Programming/theapp/node_modules/cipher-base'
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:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }
assets by status 9.45 KiB [cached] 2 assets
assets by status 11.6 MiB [emitted]
  assets by chunk 11.6 MiB (name: main)
    asset static/js/bundle.js 6.54 MiB [emitted] (name: main) 1 related asset
    asset main.74105d8de409bbf75dcd.hot-update.js 5.07 MiB [emitted] [immutable] [hmr] (name: main) 1 related asset
  assets by path *.json 699 bytes
    asset asset-manifest.json 671 bytes [emitted]
    asset main.74105d8de409bbf75dcd.hot-update.json 28 bytes [emitted] [immutable] [hmr]
  asset index.html 1.67 KiB [emitted]
Entrypoint main 11.6 MiB (10.7 MiB) = static/js/bundle.js 6.54 MiB main.74105d8de409bbf75dcd.hot-update.js 5.07 MiB 3 auxiliary assets
cached modules 5.88 MiB [cached] 1124 modules
runtime modules 31.5 KiB 17 modules
./src/index.js 1.83 KiB [built] [code generated]

WARNING in ./node_modules/@ethersproject/abi/lib.esm/_version.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/_version.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/_version.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/fragments.js 6:0-37 7:26-33
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 3:0-117 6:0-204 6:0-204 6:0-204 6:0-204 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/abi-coder.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/abi-coder.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/abstract-coder.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 8:0-57 87:15-21 91:15-21
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/address.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/address.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/address.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 9:0-48 30:19-31
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/anonymous.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/anonymous.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/coders/array.js 7:0-45 215:22-36
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 10:0-44 42:19-29
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/array.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/array.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/array.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 10:0-44 42:19-29
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/boolean.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/boolean.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 11:0-48 33:19-31
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/bytes.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/bytes.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 12:0-44 39:19-29
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/fixed-bytes.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/fixed-bytes.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 13:0-55 76:17-32
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/null.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/null.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/null.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 14:0-42 50:19-28
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/number.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/number.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/number.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 15:0-46 63:17-28
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/string.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/string.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/string.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 16:0-46 36:19-30
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/coders/tuple.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js 17:0-44 45:19-29 109:22-32 119:22-32
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 4:0-56 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/fragments.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/fragments.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/fragments.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 3:0-117 6:0-204 6:0-204 6:0-204 6:0-204 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/index.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/index.ts'
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@ethersproject/abi/lib.esm/interface.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/interface.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@ethersproject/abi/src.ts/interface.ts'
 @ ./node_modules/@ethersproject/abi/lib.esm/index.js 5:0-108 6:0-204 6:0-204 6:0-204 6:0-204 6:0-204
 @ ./node_modules/web3-eth-abi/lib/index.js 28:21-59 30:16-55
 @ ./node_modules/web3-eth/lib/index.js 47:10-33
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/@metamask/detect-provider/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/@metamask/detect-provider/src/index.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/@metamask/detect-provider/src/index.ts'
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 83:45-81
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/moralis/lib/browser/MoralisWalletConnectProvider.js 66:44-83
Module not found: Error: Can't resolve '@walletconnect/web3-provider' in '/home/brian/Programming/theapp/node_modules/moralis/lib/browser'
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 73:59-100
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/errors.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/errors.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/errors.ts'
 @ ./node_modules/xhr2-cookies/dist/xml-http-request.js 47:15-34
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/index.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/index.ts'
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/progress-event.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/progress-event.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/progress-event.ts'
 @ ./node_modules/xhr2-cookies/dist/xml-http-request.js 45:23-50
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/xml-http-request-event-target.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request-event-target.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request-event-target.ts'
 @ ./node_modules/xhr2-cookies/dist/index.js 13:38-80
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/xml-http-request-upload.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request-upload.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request-upload.ts'
 @ ./node_modules/xhr2-cookies/dist/xml-http-request.js 51:32-68
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in ./node_modules/xhr2-cookies/dist/xml-http-request.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request.ts' file: Error: ENOENT: no such file or directory, open '/home/brian/Programming/theapp/node_modules/xhr2-cookies/xml-http-request.ts'
 @ ./node_modules/xhr2-cookies/dist/index.js 11:9-38
 @ ./node_modules/web3-providers-http/lib/index.js 27:11-49
 @ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
 @ ./node_modules/web3-core/lib/index.js 23:23-58
 @ ./node_modules/web3/lib/index.js 32:11-31
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

WARNING in src/index.js
  Line 6:10:  'MoralisProvider' is defined but never used  no-unused-vars

24 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in '/home/brian/Programming/theapp/node_modules/cipher-base'

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:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }
 @ ./node_modules/create-hash/browser.js 11:11-33
 @ ./node_modules/ethereumjs-util/dist.browser/hash.js 42:17-39
 @ ./node_modules/ethereumjs-util/dist.browser/index.js 46:13-30
 @ ./node_modules/web3-utils/lib/utils.js 29:21-47
 @ ./node_modules/web3-utils/lib/index.js 26:12-33
 @ ./node_modules/web3/lib/index.js 44:12-33
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in '/home/brian/Programming/theapp/node_modules/eth-lib/lib'

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:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }
 @ ./node_modules/swarm-js/lib/api-browser.js 32:12-40
 @ ./node_modules/web3-bzz/lib/index.js 25:12-31
 @ ./node_modules/web3/lib/index.js 42:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in '/home/brian/Programming/theapp/node_modules/ethereumjs-util/dist.browser'

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:
        - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
        - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "assert": false }
 @ ./node_modules/ethereumjs-util/dist.browser/index.js 34:13-33
 @ ./node_modules/web3-utils/lib/utils.js 29:21-47
 @ ./node_modules/web3-utils/lib/index.js 26:12-33
 @ ./node_modules/web3/lib/index.js 44:12-33
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in '/home/brian/Programming/theapp/node_modules/ethereumjs-util/dist.browser'

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:
        - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
        - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "assert": false }
 @ ./node_modules/ethereumjs-util/dist.browser/index.js 40:13-33
 @ ./node_modules/web3-utils/lib/utils.js 29:21-47
 @ ./node_modules/web3-utils/lib/index.js 26:12-33
 @ ./node_modules/web3/lib/index.js 44:12-33
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in '/home/brian/Programming/theapp/node_modules/ethereumjs-util/dist.browser'

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:
        - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }'
        - install 'assert'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "assert": false }
 @ ./node_modules/ethereumjs-util/dist.browser/index.js 64:13-32
 @ ./node_modules/web3-utils/lib/utils.js 29:21-47
 @ ./node_modules/web3-utils/lib/index.js 26:12-33
 @ ./node_modules/web3/lib/index.js 44:12-33
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in '/home/brian/Programming/theapp/node_modules/web3-eth-accounts/lib'

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:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }
 @ ./node_modules/web3-eth/lib/index.js 45:15-43
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in '/home/brian/Programming/theapp/node_modules/web3-eth-accounts/node_modules/eth-lib/lib'

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:
        - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
        - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "crypto": false }
 @ ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/account.js 1:14-32
 @ ./node_modules/web3-eth-accounts/lib/index.js 29:14-44
 @ ./node_modules/web3-eth/lib/index.js 45:15-43
 @ ./node_modules/web3/lib/index.js 34:10-29
 @ ./node_modules/moralis/lib/browser/MoralisWeb3.js 57:34-49
 @ ./node_modules/moralis/lib/browser/Parse.js 45:42-66
 @ ./node_modules/moralis/index.js 1:0-50
 @ ./node_modules/react-moralis/lib/index.esm.js 3:0-36 5307:11-24
 @ ./src/index.js 9:0-48

.....

And more but I can’t post because of maximum post length

This is the package.json file

{
  "name": "theapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.1",
    "@testing-library/react": "^12.1.2",
    "@testing-library/user-event": "^13.5.0",
    "moralis": "^0.0.178",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-moralis": "^0.3.11",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

try to modify your react-scripts to 4.0.3. The latest React version uses webpack v5 in its react-scripts which is not working so well at the moment with Moralis SDK. I recommend using 4.0.3 because it is using webpack 4 which is stable and currently used by the Ethereum Boilerplate.

I change the “react-scripts”: “^4.0.3”

Then I run npm install

This is the result

Compiled with warnings.

./node_modules/moralis/lib/browser/MoralisWalletConnectProvider.js
Module not found: Can't resolve '@walletconnect/web3-provider' in '/home/brian/Programming/theapp/node_modules/moralis/lib/browser'

The react app is still working, but with warning in compiling.

1 Like

you have to install walletconnect separately

Thank you fixed it with installing npm i walletconnect

1 Like

yes it this warning is a known issue and we’ll need to find a solution to remove the warning. Regardless, it’s an optional dependecy and will not affect running your React app at all. If you would like to remove the warning, just npm i @walletconnect/web3-provider and it will disappear.

Yea, thanks @YosephKS did that installation and the warning disappear. I think react-moralis could fix the dependency issue(react-scripts and walletconnect), so that we don’t have to do it manually. But here thanks for the help.

This is not solved. Indeed this creates issues with existing projects since it breaks “react-error-overlay”. This package updated its dependencies to support webpack v5, and that version of webpack is not compatible with react-scripts v4 as described in here:

Not sure how to proceed since their solution won’t work.

Solution hack that worked for me:
npm i [email protected]

I deleted my entire dependency tree and rebuilt it again with npm and react-scripts in package.json version 4.0.3 and everything works fine, at least until I get a proper solution.

To get webpack 5 to work with the react boilerplate I installed react-app-rewired and made a config-overrides.js file in the root folder and installed the corresponding packages (config-overrides.js file below)

/* config-overrides.js */
const webpack = require('webpack');
module.exports = function override(config, env) {
    //do stuff with the webpack config...

    config.resolve.fallback = {
        url: require.resolve('url'),
        assert: require.resolve('assert'),
        crypto: require.resolve('crypto-browserify'),
        http: require.resolve('stream-http'),
        https: require.resolve('https-browserify'),
        os: require.resolve('os-browserify/browser'),
        buffer: require.resolve('buffer'),
        stream: require.resolve('stream-browserify'),
    };
    config.plugins.push(
        new webpack.ProvidePlugin({
            process: 'process/browser',
            Buffer: ['buffer', 'Buffer'],
        }),
    );

    return config;
}

Then in package.json changed the scripts commands to this:

  "scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test",
    "eject": "react-app-rewired eject"
  },
4 Likes