Cloudflare DevelopersCD
Cloudflare Developers2y ago
10 replies
Kevin

Have a fun one for the Workers team...

Have a fun one for the Workers team... itty-router is staged to release as v5, but we're running into an issue with the direct export signature.

Background:
An itty Router instance is a Proxy, with a fetch method. This matches the expected { fetch } signature that Cloudflare or Bun expect. However, CF is having issues with the Proxy (Bun is fine with it, for comparison).

const router = Router()

// doesn't work (but should)
export default router

// works
export default {
  fetch: router.fetch
}

// works
export default { ...router }
Was this page helpful?