Function resolve_from

Source
pub fn resolve_from(
    target: &str,
    basedir: PathBuf,
) -> Result<PathBuf, ResolutionError>
Expand description

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

match resolve_from("./index.js", env::current_dir().unwrap()) {
    Ok(path) => println!("Path is: {:?}", path),
    Err(err) => panic!("Failed: {:?}", err),
}