aboutsummaryrefslogtreecommitdiff
path: root/src/resolver/resolver.zig
diff options
context:
space:
mode:
authorGravatar Vlad Sirenko <sirenkovladd@gmail.com> 2023-08-01 05:41:41 +0300
committerGravatar GitHub <noreply@github.com> 2023-07-31 19:41:41 -0700
commit7a8f57c4e527f7fc84b85a4757723bb97540ebc3 (patch)
treefdbc43040069373b3af33770e00e47ad53b35dc4 /src/resolver/resolver.zig
parent8589ba2f1712d68199fbef14f5a4ba9005df3065 (diff)
downloadbun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.tar.gz
bun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.tar.zst
bun-7a8f57c4e527f7fc84b85a4757723bb97540ebc3.zip
throw error if node module does not exist (#3913)
Diffstat (limited to 'src/resolver/resolver.zig')
-rw-r--r--src/resolver/resolver.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 49ce9ec11..8735981fc 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -1262,6 +1262,12 @@ pub const Resolver = struct {
const had_node_prefix = strings.hasPrefixComptime(import_path, "node:");
const import_path_without_node_prefix = if (had_node_prefix) import_path["node:".len..] else import_path;
+ if (had_node_prefix) {
+ // because all node modules are already checked in ../linker.zig (JSC.HardcodedModule.Aliases.get) if module is not found here, it is not found at all
+ // so we can just return not_found
+ return .{ .not_found = {} };
+ }
+
if (NodeFallbackModules.Map.get(import_path_without_node_prefix)) |*fallback_module| {
result.path_pair.primary = fallback_module.path;
result.module_type = .cjs;