question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UPD: the problem is after

npm install --save @walletconnect/web3-provider

Is this project alive? Webpack5 is already not young, but compilation of this lib fails with messages:

ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 21:11-26
Module not found: Error: Can't resolve 'http' in 'node_modules\xhr2-cookies\dist'

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: { "http": require.resolve("stream-http") }'
        - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "http": false }
 @ ./node_modules/xhr2-cookies/dist/index.js 6:9-38
 @ ./node_modules/@walletconnect/http-connection/dist/esm/index.js 2:0-46 4:47-61
 @ ./node_modules/@walletconnect/web3-provider/dist/esm/index.js 3:0-60 268:28-42
 @ ./src/components/BodyTop/index.jsx 8:0-65 147:29-50
 @ ./src/components/AppIndex/AppIndex.jsx 3:0-37 7:133-140
 @ ./src/components/AppIndex/index.js 1:0-31 1:0-31
 @ ./src/components/index.js 2:0-27 2:0-27
 @ ./src/index.jsx 3:0-35 4:41-44

and a lot of the same errors:

Can't resolve 'https'
Can't resolve 'util' in 'node_modules\web3-provider-engine\util'
 Can't resolve 'os' in '\node_modules\xhr2-cookies\dist'

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:12

github_iconTop GitHub Comments

8reactions
mikjakbiakcommented, Feb 19, 2022

We use CRA 5, and to fix the problem I installed craco, created craco.config.js and put there

const webpack = require('webpack')

module.exports = {
    webpack: {
        plugins: {
	    add: [
	        new webpack.ProvidePlugin({
		    Buffer: ['buffer', 'Buffer'],
		}),
	    ],
	},
	configure: {
	    resolve: {
		fallback: {
		    stream: require.resolve('stream-browserify'),
		    https: require.resolve('https-browserify'),
		    os: require.resolve('os-browserify/browser'),
		    http: require.resolve('stream-http'),
		    buffer: require.resolve('buffer'),
		},
	    },
	},
    },
}

And then install all necessary packages yarn add stream-browserify url assert util stream-http https-browserify os-browserify buffer. Everything works fine but I still get those source maps warnings @Wemmons831 mentioned

2reactions
James0x9034commented, Oct 11, 2021

Im also getting the same error 😦(

Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack 5: Failed to parse source map from "@mswjs ...
Describe the bug. New webpack 5.0 throwing compilation error regarding source map not found image. there are multiple of these, but for the ......
Read more >
Upgrade to Webpack 5 failing - node.js - Stack Overflow
Failed to compile. Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Read more >
Webpack 5 Issues | Documentation - Web3Auth
This issue is caused due to the fact that the web3.js and ethers.js packages have certain dependencies, which are not present within the...
Read more >
Webpack 5 Pollyfill Error - AlgoSDK - Algorand Forum
I posted this Issue on GitHub for a bug in PeraWallet Connect. However, the PeraWallet team has been unable to solve it.
Read more >
To v5 from v4 - webpack
Level 1: Schema validation fails. Configuration options have changed. There should be a validation error with a BREAKING CHANGE: note, or a hint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found