nft-minter-tutorial icon indicating copy to clipboard operation
nft-minter-tutorial copied to clipboard

webpack < 5 used to include polyfills for node.js core modules by default.

Open enri90 opened this issue 3 years ago • 5 comments

`ERROR in ./node_modules/web3-providers-http/lib/index.js 32:12-28 Module not found: Error: Can't resolve 'https' in '/home/enrico/Scrivania/Sale/nft-minter-tutorial/nft-minter/node_modules/web3-providers-http/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: { "https": require.resolve("https-browserify") }' - install 'https-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "https": false } @ ./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/@alch/alchemy-web3/dist/esm/index.js 2:0-24 41:24-28 @ ./src/util/interact.js 17:4-33 @ ./src/Minter.js 7:0-87 22:14-39 59:33-46 68:14-21 @ ./src/App.js 5:0-30 11:35-41 @ ./src/index.js 7:0-24 11:33-36`

enri90 avatar Jan 25 '22 20:01 enri90

still broken for me on latest main branch -- dependencies need to be updated

nconfrey avatar Jul 18 '22 21:07 nconfrey

can you see if this helps you resolve? @nconfrey

https://www.alchemy.com/blog/how-to-polyfill-node-core-modules-in-webpack-5

thatguyintech avatar Jul 20 '22 03:07 thatguyintech

@thatguyintech unfortunately still doesn't compile, this time with a webpack error:

$ npm start
> [email protected] start
> react-app-rewired start

Failed to compile.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.resolve has an unknown property 'fallback'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
   -> Options for the resolver

Seems like step "3. Override the create-react-app webpack config file" might be using a different version of webpack for the overrides? Not sure how to proceed from here.

nconfrey avatar Jul 22 '22 09:07 nconfrey

How's this?

https://stackoverflow.com/a/71280203/17146158

I'll go through the tutorial from scratch and see what's up

thatguyintech avatar Jul 22 '22 11:07 thatguyintech