cloudflare / cloudflare/workers-rs
[Feature] Improve deployment ergnomics
- Dominant language
- Rust
- Stars
- 3.7k
- Forks
- 429
- Avg merge
- 20h 28m
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Description
Perhaps I am missing something here, but at the moment `wrangler` expects the top level Javascript code to have a default export, which is an object containing the functions `fetch` and, optionally, `scheduled`.
It seems like this could be made a lot more flexible if the Rust code just called `add_event_handler("fetch", ...)` internally and would significantly reduce the amount of augmentation required to the wasm-bindgen glue code. Any thoughts on this? Am I missing something?
The workflow that I would like to have is that I can pass the output of wasm-bindgen directly into a bundler such as Webpack and upload the resulting bundle as is to a Cloudflare worker. At the moment, this doesn't work due to the way Webpack bundles everything (it hides the `fetch` and `scheduled` functions inside the body of a function).
Contributor guide
Assessment
This issue has not been assessed yet.