Skip to content

Commit

Permalink
node: should always be a builtin (#9250)
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Sep 18, 2023
1 parent 52254bb commit 5ac4567
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/utils/node-resolver-rs/src/specifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ impl<'a> Specifier<'a> {
}
}
SpecifierType::Cjs => {
let builtin = specifier.strip_prefix("node:").unwrap_or(specifier);
if BUILTINS.contains(&builtin) {
(Specifier::Builtin(Cow::Borrowed(builtin)), None)
if let Some(node_prefixed) = specifier.strip_prefix("node:") {
return Ok((Specifier::Builtin(Cow::Borrowed(node_prefixed)), None));
}

if BUILTINS.contains(&specifier) {
(Specifier::Builtin(Cow::Borrowed(specifier)), None)
} else {
#[cfg(windows)]
if !flags.contains(Flags::ABSOLUTE_SPECIFIERS) {
Expand Down

0 comments on commit 5ac4567

Please sign in to comment.