question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: allow multiple paths for `packageDefaultDependenciesDirectory`

See original GitHub issue

I can currently set the location of “node_modules” like this:

# user settings
{
  ...
  "solidity.packageDefaultDependenciesDirectory": "node_modules"
  ...
}

The structure of my repo looks like this:

  • root
    • packages
      • package1
        • contracts
      • package2
        • contracts

Since I’m using yarn workspaces, most of my third-party contracts are cached at the root. vscode-solidity has no trouble with those contracts.

However, sometimes I have to use the nohoist feature, which moves the contracts down below in “package1”, “package2”, etc. When that happens, I get this error:

Source "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol" not found; File import callback not supported

This could be solved by allowing multiple (glob) paths in the packageDefaultDependenciesDirectory user setting. Example:

# user settings
{
  ...
  "solidity.packageDefaultDependenciesDirectories": [
    "node_modules",
    "packages/package1/node_modules",
    "packages/package2/node_modules"
  ]
  ...
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
juanfranblancocommented, Apr 4, 2022

@kerloom for this you can use remappings, Edit: this is what it is used by brownie Edit2: You can put your remappings in the settings also.

1reaction
kerloomcommented, Apr 4, 2022

I think this might be a good idea not only for mono-repos. How would one go about and set up the dependencies folders for globally installed packages? In my case I have truffle installed globally while other packages like openzeppelin locally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble importing OpenZeppelin Contracts into VS Code
I fixed it. for some reason, it needed me to include the root path to the node_modules setting. Solidity: Package Default Dependencies Directory...
Read more >
vscode-solidity/Lobby - Gitter
Hey @juanfranblanco , I submitted an issue for my feature request to add a combined .sol file for etherscan: juanfranblanco/vscode-solidity#44.
Read more >
VS Code Extension for Solidity Smart Contracts in Ethereum
Solidity is the language used in Ethereum to create smart contracts, this extension provides: Syntax highlighting; Snippets; Compilation of the current ...
Read more >
The Complete Tutorial On Getting Started With Smart ...
Go to https://nodejs.org/en/ and download the version for Latest Features on ... VS Code to your PATH, which allows launching VS Code from...
Read more >
Collaborator Feature Requests - SmartBear Community
OIDC is much simpler to set up than SAML and having support for ... base name in different directories, or just want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found