Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
enri90 opened this issue Jan 25, 2022 · 5 comments

Comments

@enri90
Copy link

enri90 commented Jan 25, 2022

`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`

@himanshu64
Copy link

this issue resolved https://github.com/himanshu64/nftappwith-alchemy

@nconfrey
Copy link

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

@thatguyintech
Copy link

can you see if this helps you resolve? @nconfrey

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

@nconfrey
Copy link

@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.

@thatguyintech
Copy link

How's this?

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants