unjs / unenv

🕊️ Convert javaScript code to be runtime agnostic
MIT License
348 stars 18 forks source link

Cloudflare asyncContext support, how to enable? #280

Open ayalon opened 1 week ago

ayalon commented 1 week ago

Describe the change

I see a lot of efforts to make the experimental feature asyncContext introduced here to work on cloudflare workers.

  experimental: {
    asyncContext: true,
  },

My code depends on this flag but unfortunatly I find no documentation / way to add support for this to may cloudflare worker application.

In wrangler.toml I have this: compatibility_flags = [ "nodejs_compat" ]

In the documentation of unjs/unenv I find no clear instruction how to use the preset. I build and deploy my application like this: NITRO_PRESET=cloudflare nuxt build

But this is obviously not enough because the application still crashing because asyncContext is not working / enabled / polyfilled.

I highly appreciate any documentation how to enable / use the preset with nuxt.

URLs

No response

Additional information