Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Add support for node_modules imports #22

Open
SeekTheError opened this issue Jun 22, 2018 · 1 comment
Open

Add support for node_modules imports #22

SeekTheError opened this issue Jun 22, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@SeekTheError
Copy link
Contributor

Similar to what truffles allow, it would be nice to be able to import contracts that are located in the node_modules folder rather than having to copy them over inside of the contract path.

ex:

import "@appliedblockchain/trufflib/libraries/Sig.sol";

where "@appliedblockchain/trufflib" is an installed node module

@SeekTheError SeekTheError added the enhancement New feature or request label Jun 22, 2018
@mtomov
Copy link
Contributor

mtomov commented Jul 30, 2018

To handle that, I'd usually override the solc parameter, like:

  // test/helpers/init.js
  const solc = require('@appliedblockchain/cobalt/solc')({
    root: join(__dirname, '..', '..', 'contracts'),
    solc: 'solc zos-lib=../node_modules/zos-lib @appliedblockchain/trufflib=../node_modules/@appliedblockchain/trufflib',
    allowPaths: '../,'
  })

and then:

 const { web3 } = require('@appliedblockchain/cobalt/web3')({
    solc
 })

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants