Skip to content
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

Fix plugin dependency checks and set npmPackage values on plugins #6046

Open
wants to merge 2 commits into
base: v-next
Choose a base branch
from

Conversation

antico5
Copy link
Contributor

@antico5 antico5 commented Dec 11, 2024

This PR addresses #6035

The original scope of the issue was to set the npmPackage property of our hardhat3 plugins, so when an import fails we can give detailed information if a given plugin package is missing, or some of its peer dependencies.

When running a test scenario, specifically using hardhat-viem and not having the viem peer dep installed, I noticed that even after setting the npmPackage property on our plugin, the error message wasn't helping. This lead me to debug the core plugins/detect-plugin-npm-dependency-problems.ts module.

I noticed that the require.resolve function was not working, and after thorough debugging I found out that the createRequire function doesn't work properly when passing an absolute path to a directory without a trailing forward slash. Adding the trailing forward slash to the directory path would make the require instance work.

After that, I started to get the error that package.json was not being exported by our modules, and we need to require() those to find the peer dependencies of packages. Then I added an export of package.json to all of our modules.

Closes #6035

@antico5 antico5 added the v-next A Hardhat v3 development task label Dec 11, 2024
@antico5 antico5 requested a review from alcuadrado December 11, 2024 13:27
Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 2:16pm

Copy link

changeset-bot bot commented Dec 11, 2024

⚠️ No Changeset found

Latest commit: 06f1e9a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@schaable schaable added status:ready This issue is ready to be worked on and removed status:triaging labels Dec 30, 2024
@kanej kanej linked an issue Jan 7, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on v-next A Hardhat v3 development task
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

Include npmPackage in all our plugins
3 participants