Crate node_resolve

Source
Expand description

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.
Resolver
Resolver instances keep track of options.

Functions§

is_core_module
Check if a string references a core module, such as “events”.
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.