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

Unable to resolve import: "INSERT_CONTRACT" with remappings when using NPM workspaces #58

Open
kamescg opened this issue Jun 19, 2022 · 2 comments

Comments

@kamescg
Copy link

kamescg commented Jun 19, 2022

The situation

I have Turborepo + pnpm project setup; a workspaces monorepo with a symlink dependency graph.

When running hardhat compile with the foundry-rs/hardhat-* plugins installed I get the following mapping errors.

[⠊] Compiling...
[⠒] Unable to resolve import: "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol" with remappings:
        contracts/=/Users/kames/workspace/kames/code/turbo-eth/contracts/
[⠢] Unable to resolve import: "@openzeppelin/contracts/access/Ownable.sol" with remappings:
        contracts/=/Users/kames/workspace/kames/code/turbo-eth/contracts/
[⠆] Unable to resolve import: "@openzeppelin/contracts/token/ERC20/IERC20.sol" with remappings:
        contracts/=/Users/kames/workspace/kames/code/turbo-eth/contracts/
...
...
...
[⠊] Unable to resolve import: "../../node_modules/zeppelin-solidity/contracts//math/SafeMath.sol" with remappings:
        contracts/=/Users/kames/workspace/kames/code/turbo-eth/contracts/

This is obviously a problem with my monorepo build system, but just wanted to flag this issue.

Maybe someone has an idea for a good work-around to get foundry-rs to work nicely in an NPM workspaces build setup?

@tynes
Copy link
Collaborator

tynes commented Jun 20, 2022

What do your remappings, filesystem and deps look like? I'm not sure if this is a problem with the hardhat plugin, foundry/ethers-rs or your config. I was able to use foundry within a monorepo to import other packages in the Optimism monorepo, although we have refactored it to no longer need to import contracts from other packages.

@kamescg
Copy link
Author

kamescg commented Jun 20, 2022

Let me double check all the configurations and I will get back to you. I ran the same smart contract repo outside of the monorepo and it compiled without any of the remapping warnings, so I assume I everything was fine, but I also may have missed something else and I just want to double check before I look foolish ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants