Worker custom webpack bundle doesn’t work properly with format=‘modules’
I try to build my worker using webpack. When i use service-worker syntax it bundles properly. But when i am trying to use an modules syntax i get an empty file and not able to run it.
Can someone help me to setup configs properly?
4 Replies
Here are my cloudflare community post: https://community.cloudflare.com/t/worker-custom-bundle-doesnt-work-properly-with-format-modules/574578/1
Cloudflare Community
Worker custom bundle doesn't work properly with format='modules'
I am trying to build my worker using webpack. When i use service-worker syntax it bundles properly. But when i am trying to use an modules syntax i get an empty file and not able to run it. Can someone help me to setup configs properly? My webpack configs are: module.exports = { target: 'webworker', entry: './src/worker.mjs', mode: 'produc...
wrangler
automatically infers format now, if that is what you mean
You don't tell it to use module
syntax manually, it will just figure it out itselfOkay, but it doesn't work anyway. I am getting empty build file if using module syntax. In other hand it is working when using service-worker syntax. Is there some config property i missed?
wrangler
itself doesn't support Webpack builds at all anymore(unless you do it manually with a custom build, as you appear to be doing). If webpack isn't building correctly, then that is an issue with your webpack config.