it looks as Wrangler has embedded Webpack function, In code in Cloudflare panel I can see included library.
But I wanted to assembly package manually. I have prepared webpack.config.js
....
output: {
filename: "worker.js",
path: path.resolve(__dirname, "dist"),
library: 'webpack-test',
libraryTarget: 'commonjs2'
and receive webpack result in dist folder
(()=>{"use strict";var e={d:(t,o)=>{ .... }})}};module.exports["webpack-test"]=t})();
Then I try to load this result to Cloudflare “wrangler deploy” with setup in TOML file of webpack result
...
main = "./dist/worker.js"
And receive this strange result
⛅️ wrangler 3.36.0
-------------------
Total Upload: 2.21 KiB / gzip: 0.96 KiB
X [ERROR] A request to the Cloudflare API (/accounts/879d75a301cfdc25c307469b83b91862/workers/scripts/webpack) failed.
No event handlers were registered. This script does nothing.
[code: 10021]
Why? What I done wrong? Or Webpack not applicable to Worker at all?
I’m newbie with Cloudlare worker, sorry for my stupid question.