useing web3 in React has error : webpack < 5 used to include polyfills for node.js core modules by default
useing web3 in React has error : webpack < 5 used to include polyfills for node.js core modules by default
我尝试在 Reactjs 中使用 web3,但是当我导入 web3 时出现错误:
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.
我使用 nodejs 14.18 和 webpack 5.5.0
使用 package.json 中的分辨率 (仅适用于 yarn)
"resolutions": {
"webpack": "5.5.0" // <- Add require version
}
yarn install
我的代码中的示例
我根据这个 link 将 react-scripts 版本更改为“^4.0.3”解决了这个错误:https://forum.moralis.io/t/problem-with-web3ui/12725/5
我尝试在 Reactjs 中使用 web3,但是当我导入 web3 时出现错误:
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.
我使用 nodejs 14.18 和 webpack 5.5.0
使用 package.json 中的分辨率 (仅适用于 yarn)
"resolutions": {
"webpack": "5.5.0" // <- Add require version
}
yarn install
我的代码中的示例
我根据这个 link 将 react-scripts 版本更改为“^4.0.3”解决了这个错误:https://forum.moralis.io/t/problem-with-web3ui/12725/5