-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the issue
Context
While Hardhat has native support for remappings.txt, multiple projects define them in their foundry.toml, and forge autogenerate some of them in the presence of a foundry.toml
.
In those cases hardhat can fail to compile a project, due to missing remappings.
Proposal
We need to create a really simple hardhat-foundry
plugins that loads those remappings to.
Expected behavior
Whenever hardhat loads the remappings for a package (either the hardhat project itself, or an npm module), it the plugin should use forge remappings
to load those remappings too.
Design
We should add a hook to the package loading process, which happens here:
Line 392 in f29d1d8
async #readPackageRemappings( |
Just like we find all the remappings.txt
files here, we should look for the foundry.toml
files (that are not a node_modules
), and run foge remappings
in the context of that file's directory.
Out of scope
- This plugin won't install forge, but fail with a clear message if it isn't installed.
- This plugin won't change any default config of hardhat, like paths.
Open questions
- Can our
Remapping
-related types accommodate for this? For example,source
is expected to be aremapping.txt
absolute path. Can we reuse it? Will the logic and error reporting break?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status