Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Reqwire always calls process.cwd with relative files #90

Open
ricardohbin opened this issue Jul 22, 2015 · 1 comment
Open

Reqwire always calls process.cwd with relative files #90

ricardohbin opened this issue Jul 22, 2015 · 1 comment

Comments

@ricardohbin
Copy link

If the file isn't a npm module, reqwire always require it using the current executable path.
This causes problems when we don't start the application in its root.

Ex: node /app/my-app/server

@grawk
Copy link
Member

grawk commented Jan 29, 2016

Apologies for leaving this without comment for so long.

You are right, that's the behavior. It seems like a pretty good convention. Other options:

  • if a module is not found via the process.cwd() + /path/to/module, use /path/to/module as an absolute path
  • refactor the "helpers" API to include a configuration option for the root path from which reqwire should start looking

The first one has the potential to be a bit magical, and could conceivably end up requiring a module that you don't intend (edge case, but possible). The second option represents a breaking change to the API, and a fair amount of effort.

If you're still looking for this fix, we can discuss further.

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

No branches or pull requests

2 participants