You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we require('dependency') from index.js, node will search through all ancestor directories for node_modules/dependency.
However, cordova-fetch doesn't support this. Instead, it will install dependency again (from the npm repository) inside myproject/packages/subproject/node_modules
This is a problem for use cases like yarn workspaces, where the standard node module resolution algorithm is used to help "dependency" be developed alongside "subproject".
Solving this problem could be a good way to improve support for yarn workspaces without needing to add explicit support for yarn.
References:
resolve package - aims to implement node's algorithm fully, could be used as an alternative to get-installed-path
Thanks for bringing this to our attention. I think we should indeed try to support the node's full module resolution. Either using the package you linked to or sindresorhus/resolve-from. Frankly I'd prefer the latter, as it actually uses node's implementation.
If the resolved module path does not satisfy the spec, I'd just stop there and continue with installing the requested version. Alternatively we could try searching upwards for the correct version, but I'd rather stick to node's plain module resolution. I can't imagine any use cases that would benefit from doing more than require can do. What do you think?
Currently, cordova-fetch only checks the project's node_module directory, without checking parent directories. For example, in:
If we
require('dependency')
from index.js, node will search through all ancestor directories for node_modules/dependency.However,
cordova-fetch
doesn't support this. Instead, it will installdependency
again (from the npm repository) inside myproject/packages/subproject/node_modulesThis is a problem for use cases like yarn workspaces, where the standard node module resolution algorithm is used to help "dependency" be developed alongside "subproject".
Solving this problem could be a good way to improve support for yarn workspaces without needing to add explicit support for yarn.
References:
The text was updated successfully, but these errors were encountered: