-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] add esm support #1994
[WIP] add esm support #1994
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this PR. Unfortunately, I don't think this approach will work. I left a comment explaining why.
ctx.setHardhatRuntimeEnvironment(env); | ||
|
||
env.injectToGlobal(); | ||
// TODO: Implication is this becoming async? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will lead to a race condition. Same for packages/hardhat-core/src/internal/lib/hardhat-lib.ts
Yes, sorry for the noise but github.dev required me to create a PR in order to pull this locally So, my idea is to export an {initialized} field that needs to be
this would be backwards compatible with esm as the Wdyt? |
Unfortunately that would be a breaking change |
|
The way that hardhat imports tasks and plugins also won't work with ESM because all ESM modules are executed async and hardhat plugins often rely on the ordering of those imports. |
That's an excellent point, @phated! thanks |
Everything suggests that adding support for ESM is a major endeavor that we won't be able to do until our next major (v3, which is not even in our roadmap). So I think we should close this, unless you see some way forward @1dcbh. |
WIP! I just created the PR to pull locally, will run tests are report back soon.