Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find modules in additional paths #242

Open
eduardoboucas opened this issue Oct 20, 2021 · 1 comment
Open

Find modules in additional paths #242

eduardoboucas opened this issue Oct 20, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@eduardoboucas
Copy link

I'm trying to make NFT load Node modules from additional paths that aren't necessarily ancestors of the importer's directory. If I understand correctly, the only way to do this currently is to supply a resolve hook, but that means having to rewrite the entire resolving logic.

It'd be great to equip resolvePackage() with the ability to find modules in additional paths, via a configuration property that would work like esbuild's nodePaths property, Webpack's resolve.modules or even the Node's NODE_PATH environment variable.

I'd be happy to submit a PR, but I wanted to first check if you'd be open to it, or whether you have a different recommendation.

Thanks in advance!

@styfle
Copy link
Member

styfle commented Nov 3, 2021

@eduardoboucas Sounds like it could be a good feature to match NODE_PATH behavior 👍

How about a new option with a default like the following:

nodePaths = process.env.NODE_PATH.split(';')

base = process.cwd(),
processCwd,

@guybedford Any other thoughts to add here?

@styfle styfle added the enhancement New feature or request label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants