summaryrefslogtreecommitdiff
path: root/cli/node/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/node/mod.rs')
-rw-r--r--cli/node/mod.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs
index fa6f0bdda..60b46a445 100644
--- a/cli/node/mod.rs
+++ b/cli/node/mod.rs
@@ -492,7 +492,10 @@ pub fn node_resolve(
let path = url.to_file_path().unwrap();
// todo(16370): the module kind is not correct here. I think we need
// typescript to tell us if the referrer is esm or cjs
- let path = path_to_declaration_path(path, NodeModuleKind::Esm);
+ let path = match path_to_declaration_path(path, NodeModuleKind::Esm) {
+ Some(path) => path,
+ None => return Ok(None),
+ };
ModuleSpecifier::from_file_path(path).unwrap()
}
};
@@ -532,7 +535,10 @@ pub fn node_resolve_npm_reference(
let resolved_path = match mode {
NodeResolutionMode::Execution => resolved_path,
NodeResolutionMode::Types => {
- path_to_declaration_path(resolved_path, node_module_kind)
+ match path_to_declaration_path(resolved_path, node_module_kind) {
+ Some(path) => path,
+ None => return Ok(None),
+ }
}
};
let url = ModuleSpecifier::from_file_path(resolved_path).unwrap();
@@ -794,7 +800,9 @@ fn module_resolve(
// should use the value provided by typescript instead
let declaration_path =
path_to_declaration_path(file_path, NodeModuleKind::Esm);
- Some(ModuleSpecifier::from_file_path(declaration_path).unwrap())
+ declaration_path.map(|declaration_path| {
+ ModuleSpecifier::from_file_path(declaration_path).unwrap()
+ })
} else {
Some(resolved_specifier)
}