Search code examples
solidityhardhat

imports via https not working in hardhat (solidity)


Error HH406: Invalid import https://github.com/... from contracts/MyContract.sol. Hardhat doesn't support imports via https.

Trying to import forked contract from my github but https imports are not working in hardhat but works in remix.


Solution

  • As @Kevin mentioned, Hardhat currently does not support https imports in Solidity.

    A good workaround is to use npm packages that contain the smart contracts you need. Ex. importing using the @openzeppelin/contracts package.

    Many established DApps will have their own npm package as well.