"Unexpected token 'export'" when using a primitive module from Cloudflare online worker editor

Screenshot of the error is attached.
No description
5 Replies
mrrobotov
mrrobotovOP4mo ago
Thanks, but tried already with no luck. It seems that ES modules support somehow not activated in the Cloudflare Workers wed editor. I've tried to rename existing default worker.js file extension to mjs, but each time I open web editor it is being overwritten to the current version.
James
James4mo ago
What happens if you create a new worker? The quick editor in the dashboard can be a little finnicky when transitioning from Service Worker -> ES Modules
mrrobotov
mrrobotovOP4mo ago
Tried, new worker creates with ES module based boilerplate be default with no error like mine.
James
James4mo ago
Yeah in that case, I would recommend you create a new worker, or use wrangler to manage and publish your workers
Want results from more Discord servers?
Add your server