Crate node_resolve [] [src]

Resolve module identifiers in a Node-style require() to a full file path.

use node_resolve::{resolve, resolve_from};

resolve("abc");
// → Ok("/path/to/cwd/node_modules/abc/index.js")
resolve_from("abc", PathBuf::from("/other/path"));
// → Ok("/other/path/node_modules/abc/index.js")

Structs

ResolutionError

An Error, returned when the module could not be resolved.

Functions

resolve

Resolve a node.js module path relative to the current working directory. Returns the absolute path to the module, or an error.

resolve_from

Resolve a node.js module path relative to basedir. Returns the absolute path to the module, or an error.