ComponentizeJS icon indicating copy to clipboard operation
ComponentizeJS copied to clipboard

fetch globals are not available

Open rebolyte opened this issue 3 months ago • 2 comments

I see in the tests that the global Request/Response/Headers objects are available, and I can create Headers successfully. But if I try to create Request or Response using the example, the module errors out with wasm 'unreachable' instruction executed:

diff --git a/example/hello.js b/example/hello.js
index 8671f41..fde2ac6 100644
--- a/example/hello.js
+++ b/example/hello.js
@@ -1,3 +1,11 @@
 export function hello (name) {
+  // const headers = new Headers();
+
+  const req = new Request('http://httpstat.us/200', {
+    method: 'GET',
+  });
+
+  // const res = new Response();
+
   return `Hello ${name}`;
 }

If I return Reflect.ownKeys(globalThis).join(',') from the function, I can see also see they're on the object. My end goal is to be able to run Hono inside the module, and it uses the native req/res objects. What am I missing?

rebolyte avatar May 17 '24 01:05 rebolyte