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
feat: Load hardhat.config.cjs to partially support ESM projects #3155
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This issue is also being tracked on Linear. We use Linear to manage our development process, but we keep the conversations on Github. LINEAR-ID: be8191f8-10f8-4c1f-af20-4d7d0e39feca |
With this |
👑 |
Should we review and merge this and #3017 in any particular order? |
@alcuadrado I think we should merge this one first. I believe that the TS change should also add tests for run/test tasks after those are done for JS. |
@alvrs was testing this out and pointed out that I didn't update @alcuadrado Do you think this can land soon so I can rebase #3156 and update #3017 ? |
Merging this to the |
Due to the way hardhat registers tasks, v3 can't support ESM (as I outlined at #1994 (comment)); however, you can load
.cjs
files inside an ESM project. Since many projects are converting to ESM-only, it is helpful to be able to run hardhat in those contexts.This change should allow a monorepo to become
"type": "module"
and still use hardhat in commonjs mode. 🎉This support is in parallel to my other PR (#3017) which adds this support for TypeScript. There are follow up PRs to allow loading of ESM tasks and scripts.