Open alcuadrado opened 1 year ago
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: 64af9cf5-0cb3-4ad8-b2ed-0ba7eca9910f
The same technique allows us to support importing a contract from its own package using the package name. For example, packages/main/contracts/Entry.sol
importing "main/contract/M.sol"
, and even itself.
@KaanKC you may find this interesting too!
If you import a contract that belongs to the project from another package, Hardhat fails.
1509 makes Hardhat throw a clear error in that case, but I found a way to actually support it.
If when compiling an npm/hardhat project
P
, instead of throwing here, we validate that this resolves to the same packageP
(i.e. there aren't multiple versions ofP
installed) and resolve to the local source file, we can then make it work by using remappings.In my test I got this to compile:
using the remapping
"main/="
./cc @nventuro @fvictorio