Skip to content

Hardhat 2 plugins deprecation message on load#7991

Merged
alcuadrado merged 15 commits into
mainfrom
hardhat2-plugins-deprecation-message
Feb 24, 2026
Merged

Hardhat 2 plugins deprecation message on load#7991
alcuadrado merged 15 commits into
mainfrom
hardhat2-plugins-deprecation-message

Conversation

@alcuadrado
Copy link
Copy Markdown
Member

@alcuadrado alcuadrado commented Feb 23, 2026

Fixes #7960

This is done with three kinds of changes:

  • Mock the HH2 plugin API and throw a proper error when used.
  • For common subpaths that Hardhat 2 plugins imported I
    • Added them if make sense
    • Added an empty module for the ones that don't make sense. The reason an empty module works is that HH2 plugins are CJS, so they lead to a load-time error if a value isn't exported.

This PR can be reviewed one commit at the time.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 23, 2026

🦋 Changeset detected

Latest commit: 314a2e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@alcuadrado alcuadrado added no docs needed This PR doesn't require links to documentation no peer bump needed labels Feb 23, 2026
@alcuadrado alcuadrado requested review from Copilot and schaable and removed request for Copilot February 23, 2026 14:36
Comment thread v-next/hardhat/src/internal/using-hardhat2-plugin-errors.ts Outdated
Comment thread v-next/hardhat/src/internal/using-hardhat2-plugin-errors.ts Outdated
Comment thread v-next/hardhat/src/internal/using-hardhat2-plugin-errors.ts
Comment thread v-next/hardhat/src/internal/using-hardhat2-plugin-errors.ts Outdated
@@ -0,0 +1,14 @@
export * from "./arguments.js";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, did we forget to add this file earlier?

@@ -0,0 +1,8 @@
// This is an empty module that is used to exported it with a subpath that's
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 this is very smart!

Comment thread v-next/hardhat/src/internal/cli/error-handler.ts
@alcuadrado alcuadrado enabled auto-merge February 24, 2026 16:21
@alcuadrado alcuadrado added this pull request to the merge queue Feb 24, 2026
Merged via the queue into main with commit 54a5aa9 Feb 24, 2026
203 checks passed
@alcuadrado alcuadrado deleted the hardhat2-plugins-deprecation-message branch February 24, 2026 16:49
@github-actions github-actions Bot mentioned this pull request Feb 24, 2026
@kanej
Copy link
Copy Markdown
Member

kanej commented Feb 25, 2026

This has been released as part of hardhat@3.1.10: https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%403.1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no docs needed This PR doesn't require links to documentation no peer bump needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mock HH2 plugin APIs with better error messages

3 participants