Cloudflare Workers with NodeJS npm dependencies

I’m coming over from AWS Lambda and would appreciate a bit of guidance.

Is it possible to package up an application written in Node with a bunch of npm-installed dependencies and deploy it on Cloudflare Workers?

I did that (or so I thought) with Wrangler, but my app doesn’t work at all, and when I edit it in the browser-based editor, my code has been drastically modified. It looks like all the dependencies have been bundled into one file instead of just leaving them in the node_modules directory.

On Lambda, the browser-based editor shows me my nice little directory structure complete with my node_modules directory (and any other files I might’ve uploaded) and it all makes sense to me. Do I not get any of that on Cloudflare Workers?

Thanks in advance.

1 Like