workers-rs
workers-rs copied to clipboard
[Feature] Pass `--minify` to `esbuild` in `worker-build`
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
Theoretically, it should be safe to pass --minify to esbuild here: https://github.com/cloudflare/workers-rs/blob/main/worker-build/src/main.rs#L129 (and adding a --target, see minify considerations below) which should result in a smaller glue code file (48.1kb to 22.8kb in the example I tested)
I've tested this locally for a Rust Cloudflare Worker and it worked correctly, although I'm not sure if there were specific edge cases due to which this was omitted.
See considerations for minification with esbuild here: https://esbuild.github.io/api/#minify-considerations