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§

  • An Error, returned when the module could not be resolved.
  • Resolver instances keep track of options.

Functions§

  • Check if a string references a core module, such as “events”.
  • Resolve a node.js module path relative to the current working directory. Returns the absolute path to the module, or an error.
  • Resolve a node.js module path relative to basedir. Returns the absolute path to the module, or an error.