skymethod / denoflare

Develop, test, and deploy Cloudflare Workers with Deno.
https://denoflare.dev
MIT License
692 stars 33 forks source link

bundle dynamic import (typescript) #63

Closed codehz closed 12 months ago

codehz commented 12 months ago

some dependencies use top level await, which isn't supported in cloudflare worker, I with it can provide transpile support for it

johnspurlock-skymethod commented 12 months ago

Cloudflare supports some top level awaits (like crypto calls), but not all - you'll get 10021 Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.

Did you have a question? What I do normally is a one-time init in the scope of a request

codehz commented 12 months ago

Cloudflare supports some top level awaits (like crypto calls), but not all - you'll get 10021 Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.

Did you have a question? What I do normally is a one-time init in the scope of a request

ok I found the problem is the code is trying to instantiate a wasm module, it is not support anyway (cf require to use binding), I modified the code to not use wasm, and the problem is solved