Have been trying some corvid experts, so far no one seem to know web3 and blockchain. So I am trying to figure this out myself.
So I am trying to use this code on the backend file:
import Web3 from 'web3'
const Window = require('window');
const window = new Window();
const ethEnabled = () => {
if (window.ethereum) {
window.web3 = new Web3(window.ethereum);
window.ethereum.enable();
return true;
}
return false;
}
I am getting this error on the editor “require is not defined”
And what code should I use on the front end?
I am using import instead of require here. This is something that is specific for corvid, yet not mentioned anywhere. Is this right?