导入{ethers}从“以ethers” vs const {ethers} = require(" hardhat;
我正在一个教程的指导下,在NFTmarketplace项目中工作,显然我需要“ Ethers.js”。
在我的 test.js file(我使用npx hardhat test )中,需要使用 const {ethers} = require(“ hardhat”); 。另一方面,在 home.js ( for react frontend )中,我必须使用 inter import {ethers}从“ ethers” 。
现在我的问题是,为什么我以两种不同的方式导入同样的事情。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用HardHat时,您不需要导入“以太货币”
When using hardhat you do not need to import "ethers"
https://hardhat.org/advanced/hardhat-runtime-environment?utm_source=buildspace.so&utm_medium=buildspace_project