Reputation: 33
I am working on an NFTMarketplace project with the guidance of a tutorial, where I am obviously requiring "ethers.js".
In my test.js file (which I run using npx hardhat test), it is required to use const { ethers } = require("hardhat");. On the other hand, in the Home.js (which is for react frontend), I am required to use import { ethers } from "ethers".
Now my question is, why I'm importing the same thing in 2 different ways.
Upvotes: 1
Views: 2719
Reputation: 576
When using hardhat you do not need to import "ethers"
The Hardhat Runtime Environment, or HRE for short, is an object containing all the functionality that Hardhat exposes when running a task, test or script. In reality, Hardhat is the HRE.
Upvotes: 1