3 ms·
I love the idea of Workers! The catch I ran into last year was the 1MB limit for webpacked JS files. That puts many npm packages off limits -- I ended up doing
by JackC 7y ago
I love the idea of Workers! The catch I ran into last year was the 1MB limit for webpacked JS files. That puts many npm packages off limits -- I ended up doing some webpack magic to stub out subdependencies I didn't need from a package that didn't support tree shaking, which is pretty far from "just works."
Here's a good thread where the problem package was a SOAP library depending on "request," but the same logic is easy to run into with any app: https://community.cloudflare.com/t/worker-size-limit-a-problem/24849 https://community.cloudflare.com/t/worker-size-limit-a-probl...
The upshot is if you have an idea that would be easy with dependencies, you can't reason about how difficult/possible it will be with Workers until you spend some time figuring out if the dependencies can be compressed small enough to use -- and the answer may change partway through if you need to add something.
- maltalex 7y ago> I love the idea of Workers! Could you share your use case for Workers?
- avidal 7y agoWhile we haven't relaxed the 1MB restriction, we have made some changes to the way we compress and distribute your code to the edge. I'd encourage you to try again, and our new CLI[0] handles the webpacking for you. [0] https://workers.cloudflare.com/docs/quickstart/cli-setup/ https://workers.cloudflare.com/docs/quickstart/cli-setup/