Closed HelloRickey closed 3 years ago
Use template-react, import Web3 from "web3" Prompt Object prototype may only be an Object or null: undefined
Hey unfortunately web3js only provides a node based build (with require/Buffer assumptions etc.). Until they are done with their supposed refactoring to esm its not going to work out of the box with vite. I would suggest you either look at the various rollup-plugin-node-* packages and see if you can polyfill it in vite.config.js https://github.com/vitejs/vite/issues/847
Or ditch web3 for ethers.js which seems to be of higher quality (I understand if you cant though)
Hey @MioQuispe , I used Ethers.js and it runs normally. It is even simpler than web3. Thank you very much for your create-ic-app, which makes it easier to build dfinity applications.
Use template-react, import Web3 from "web3" Prompt Object prototype may only be an Object or null: undefined