I recently switched a large cloudflare workers application from the Service Worker syntax to the ES Module syntax. Most of the work involved was related to bindings no longer being available at startup, instead they’re passed in via the lifecycle hooks (fetch, scheduled, etc), which meant I needed to pass env around each function call that required bindings.
I noticed there is at least one exception- a special module called “__STATIC_CONTENT_MANIFEST” is available using ES module import syntax:
import manifestJson from '__STATIC_CONTENT_MANIFEST';
This api is much more convenient than the env parameter on lifecycle methods.
Question: Has there been any discussion about making all bindings available as a module?
For example:
import env from '__ENV';
import { MY_KV, MY_SECRET } from '__ENV';
https://discord.com/channels/595317990191398933/1100835046878888096/1100835046878888096