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
When I import contract A.sol from "@npm-package/contracts/A.sol"
if A.sol imports B.sol from "@npm-package2/contracts/B.sol"
I expect that hardhat uses/compiles B.sol using "project/node_modules/@npm-package/node_modules/@npm-package2/contracts/B.sol"
But what happens is that hardhat compiles B.sol using "project/node_modules/@npm-package2/contracts/B.sol", which causes conflicts when multiple npm packages imports same contracts but in different versions
Please note that account-abstraction-06 depends on @openzeppelin/contracts": "^4.2.0
And account-abstraction-07 depends on @openzeppelin/contracts": "^5.0.0
3. yarn install
4. add import "account-abstraction-07/contracts/core/BasePaymaster.sol"; to Lock.sol
5. hardhat compile
You'll find that compilation fails because it tries to use OZ's Ownable.sol for a different version than the one located in "project/node_modules/account-abstraction-07/node_modules/openzeppelin/contracts/access/Ownable.sol"
Search terms
conflict, versions, compile, imports
The text was updated successfully, but these errors were encountered:
Version of Hardhat
2.22.6
What happened?
When I import contract A.sol from
"@npm-package/contracts/A.sol"
if A.sol imports B.sol from
"@npm-package2/contracts/B.sol"
I expect that hardhat uses/compiles B.sol using
"project/node_modules/@npm-package/node_modules/@npm-package2/contracts/B.sol"
But what happens is that hardhat compiles B.sol using
"project/node_modules/@npm-package2/contracts/B.sol"
, which causes conflicts when multiple npm packages imports same contracts but in different versionsMinimal reproduction steps
Please note that
account-abstraction-06
depends on@openzeppelin/contracts": "^4.2.0
And
account-abstraction-07
depends on@openzeppelin/contracts": "^5.0.0
3. yarn install
4. add
import "account-abstraction-07/contracts/core/BasePaymaster.sol";
to Lock.sol5. hardhat compile
You'll find that compilation fails because it tries to use OZ's Ownable.sol for a different version than the one located in
"project/node_modules/account-abstraction-07/node_modules/openzeppelin/contracts/access/Ownable.sol"
Search terms
conflict, versions, compile, imports
The text was updated successfully, but these errors were encountered: