Build single executable for Node

I’m trying to write Cloudflare Worker in Kotlin.js. I setup gradle project and declare wrangler-js dependency. It compiles and gives me js file with my code that depends on other modules (kotlin.js, wrangler). When I deploy it it doesn’t work (apparently cloudflare expects single self-contained js file and doesn’t resolve any modules for me). I need to make single executable with all dependencies included (while still targeting node, not browser). How can I achieve it?

I managed to solve original problem by declaring custom tasks in gradle that copy js file for my module and package.json from build dir and invoke wrangler build that invokes webpack and builds everything in one executable (exactly like cloudflare wants it).