You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bug report of an edge case that can only happen if you have a hardhat project inside a monorepo, and the hardhat project is also an npm project p.
If a solidity file within p imports another one using import "p/contracts/...", the compilation will fail. The reason for this is that the file ends up with two source names p/contract/... and contracts/....
This only happens within a monorepo, because otherwise require.resolve("p/...") would fail. In a monorepo it resolves because the top node_modules will have a symlink to p.
We should forbid importing a file using its own npm project name. We should tell the user which import to use instead.
This is a bug report of an edge case that can only happen if you have a hardhat project inside a monorepo, and the hardhat project is also an npm project
p
.If a solidity file within
p
imports another one usingimport "p/contracts/..."
, the compilation will fail. The reason for this is that the file ends up with two source namesp/contract/...
andcontracts/...
.This only happens within a monorepo, because otherwise
require.resolve("p/...")
would fail. In a monorepo it resolves because the topnode_modules
will have a symlink top
.We should forbid importing a file using its own npm project name. We should tell the user which import to use instead.
This bug can be reproduced like this:
pkg/pool-weighted/contracts/smart/LiquidityBootstrappingPool.sol
git checkout compilation-bug-reproduction
yarn
cd pkg/pool-weighted
yarn hardhat compile --show-stack-traces --verbose
The text was updated successfully, but these errors were encountered: