hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

hardhat-foundry: please support remapping contexts

Open eladmallel opened this issue 1 year ago • 1 comments

Describe the feature

While forge build works fine, we're unable to compile using hardhat.

Our remapping file looks like this:

ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
../../node_modules/@openzeppelin/contracts-upgradeable-v5:@openzeppelin/contracts=../../node_modules/@openzeppelin/contracts-v5

The compilation error we get is:

Error in plugin hardhat-foundry: Invalid remapping '../../node_modules/@openzeppelin/contracts-upgradeable-v5:@openzeppelin/contracts/=../../node_modules/@openzeppelin/contracts-v5/', remapping contexts are not allowed

We need this because we're using two versions of openzeppelin in parallel (4.1 and 5), and openzeppelin-upgradeable v5 has imports that point to @openzeppelin/contracts, which without proper remapping is resolving to v4.1, while we need to to resolve to v5.

Thank you!

Search terms

No response

eladmallel avatar Feb 01 '24 20:02 eladmallel

remapping works for me with

remappings = [ "lib/an-essential-dependency/lib/openzeppelin-contracts/=node_modules/@openzeppelin/", ]

have you tried with absolute path?

codekoriko avatar Mar 06 '24 03:03 codekoriko