Proper build process for ES6 Module Worker -> Webpack

I keep going round and round troubleshooting so I figured I would make my first post to the community here :slight_smile:

So I have been using Worker for years now but only just unlocking some of the more advanced futures, such as using Typescript, Webpack, and now ES6 Modules within Workers.

Ideally I want a process where I write in Typescript, bundle with Webpack into an ES6 module, then deploy to Workers.

What I can’t seem to crack is the build process. It seems by the time Webpack is done, I get a wrangler error insisting that No event handlers were registered. This script does nothing. since the bundles script is in ES6 module syntax that uses the new export style rather than service-worker style.

Of course, adding in the addEventListener convention in this paradigm then breaks the ES6 syntax.

Am I missing something? I have gone from Cloudflare to Developer to Cloudflare examples and boilerplates, and reinstalled and updated and reinstalled all the same tools over gain.