Skip to content

Fix latest dependencies v2 - #8311

Merged
alcuadrado merged 2 commits into
v2from
fix-latest-dependencies-v2
May 19, 2026
Merged

alcuadrado merged 2 commits into
v2from
fix-latest-dependencies-v2

Conversation

@alcuadrado

Copy link
Copy Markdown
Member

The reason this workflow was failing was that we were using both top-level and await import for viem in some packages, and with Node16 module resolution and CJS those behave differently.

The top level ones get compiled to a require, so they use the require/default condition of the package.json#exports. The await import ones use the import one. These lead to two versions being exported.

This PR normalizes it so that we always use require.

@alcuadrado
alcuadrado requested review from Copilot and kanej May 19, 2026 15:41
@changeset-bot

changeset-bot Bot commented May 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5589cfa

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

This PR includes changesets to release 2 packages
Name Type
@nomicfoundation/hardhat-viem Patch
@nomicfoundation/hardhat-ignition-viem 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses CI/workflow failures caused by mixing await import("viem") with CJS-style require-compiled imports under Node16 module resolution, which can select different package.json#exports conditions and effectively load divergent module shapes/versions. It standardizes viem loading to always use require(...) in the affected packages.

Changes:

  • Replaced dynamic await import("viem") usages with require("viem") (typed via as typeof import("viem")) across hardhat-viem internals.
  • Replaced dynamic imports of viem and viem/chains with require(...) in chain detection logic.
  • Updated hardhat-ignition-viem helper to load viem via require(...), and added changesets for both packages.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/hardhat-viem/src/internal/contracts.ts Switches viem loading from dynamic import to require for contract address calculation and getContract usage.
packages/hardhat-viem/src/internal/clients.ts Switches viem loading from dynamic import to require for client construction helpers.
packages/hardhat-viem/src/internal/chains.ts Switches viem / viem/chains loading from dynamic import to require for chain extraction/selection.
packages/hardhat-viem/src/internal/bytecode.ts Switches viem loading from dynamic import to require for hex validation in bytecode linking.
packages/hardhat-ignition-viem/src/viem-ignition-helper.ts Switches viem loading from dynamic import to require when building a contract instance.
.changeset/sharp-ignition-viem-require.md Adds a patch changeset for hardhat-ignition-viem documenting the import normalization.
.changeset/quick-viem-require.md Adds a patch changeset for hardhat-viem documenting the import normalization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@socket-security

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
License policy violation: npm @fontsource/roboto under OFL-1.1

License: OFL-1.1 - The applicable license policy does not permit this license (5) (npm metadata)

License: OFL-1.1 - The applicable license policy does not permit this license (5) (package/package.json)

License: OFL-1.1 - The applicable license policy does not permit this license (5) (package/LICENSE)

From: packages/hardhat-ignition-ui/package.json → npm/@fontsource/roboto@5.2.10

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@fontsource/roboto@5.2.10. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@alcuadrado
alcuadrado merged commit a82eb1c into v2 May 19, 2026
243 of 244 checks passed
@alcuadrado
alcuadrado deleted the fix-latest-dependencies-v2 branch May 19, 2026 16:13
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants