From e18c589de301811312802e27cd806d2eec1dcd0a Mon Sep 17 00:00:00 2001 From: Karl Seguin Date: Wed, 25 Jun 2025 18:20:55 +0800 Subject: [PATCH] Allow root modules to imported modules Root modules (non-cacheable) should register their module_id -> URL so that, if they load a nested module, we can get the full URL of the nested module. --- src/runtime/js.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/js.zig b/src/runtime/js.zig index cc48175b..6bec6520 100644 --- a/src/runtime/js.zig +++ b/src/runtime/js.zig @@ -728,7 +728,9 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { if (try m.instantiate(v8_context, resolveModuleCallback) == false) { return error.ModuleInstantiationError; } - + const arena = self.context_arena; + const owned_url = try arena.dupe(u8, url); + try self.module_identifier.putNoClobber(arena, m.getIdentityHash(), owned_url); _ = try m.evaluate(v8_context); }