ItsNickBarry / hardhat-dependency-compiler

📦 Compile Solidity sources directly from NPM dependencies
MIT License
38 stars 5 forks source link

does not take into account dependency resolution #6

Closed 3commascapital closed 2 years ago

3commascapital commented 2 years ago

hi there, i am working with a contract that depends on @uniswap/v3-periphery, which in turn depends on @openzeppelin/contracts@3.4.1 which has a pragma solidity declaration of >=6, <8.

However my project uses 0.8.9 and the @openzeppelin/contracts@4.5.0 which uses a different structure, and fails when the dependency compiler path is used. I have installed the node_module in the sub directory, at project-root/node_modules/@uniswap/v3-periphery/node_modules/@openzeppelin/contracts, using the resolutions key as defined by yarn, and that seemed to work (i can see the folder) but dependency compiler does not seem to see the resolutions folder or that there is a node_modules in the uniswap periphery folder.

All this to ask, does it make sense to utilize sub / localized dependencies when compiling dependencies?

ItsNickBarry commented 2 years ago

This may be an issue with Hardhat. Hardhat does not support nested Solidity dependencies because different package managers (and configuration options like resolutions) create inconsistent node_modules directory structures. This plugin simply creates a temporary .sol file with a pragma of * and an import of the path specified in Hardhat config. This means that the dependency resolution is handled internally by Hardhat.

Installing the sub-dependencies as top-level dependencies might work.

3commascapital commented 2 years ago

gotcha. thanks for clarifying