cloudflare · Cloudflare Workers Docs
Migrate To Module Workers Migrate from Service Workers to ES Modules
A guide for converting Cloudflare Workers from the legacy Service Worker syntax to the modern ES modules format, including syntax changes for request handling, bindings, and environment variables.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Migrate To Module Workers Migrate from Service Workers to ES Modules
A guide for converting Cloudflare Workers from the legacy Service Worker syntax to the modern ES modules format, including syntax changes for request handling, bindings, and environment variables.
When To Use
Use when you need to refactor existing Service Worker code to ES modules to enable features like Durable Objects, D1, or Workers AI.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-migrate-to-module-from-service-es-modules-workflow-guide.md | A guide detailing the steps and advantages of migrating Cloudflare Workers from the Service Worker format to the ES modules format. | Questions about a guide detailing the steps and advantages of migrating Cloudflare Workers from the Service Worker format to the ES m... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser.text | A text comparison showing the transition from service worker event listeners to ES module export syntax for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text comparison showing the transition from service worker event listeners to ES module export syntax for Cloudflar... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-2.text | A code example demonstrating the conversion of a Service Worker fetch handler to an ES Module export default object for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A code example demonstrating the conversion of a Service Worker fetch handler to an ES Module export default object f... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-3.text | A text representation of a service worker configuration being converted to an ES module worker format. | Exact payloads, commands, or snippets shown in A text representation of a service worker configuration being converted to an ES module worker format. |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-4.text | A text-based example demonstrating how to update KV namespace bindings when migrating from Service Worker syntax to ES Modules in Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text-based example demonstrating how to update KV namespace bindings when migrating from Service Worker syntax to E... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-5.text | A text comparison showing the transformation of a fetch event listener from the Service Worker syntax to the ES Modules syntax. | Exact payloads, commands, or snippets shown in A text comparison showing the transformation of a fetch event listener from the Service Worker syntax to the ES Modul... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-6.text | A code example demonstrating the transition from Service Worker syntax to ES Module syntax in Cloudflare Workers. | Exact payloads, commands, or snippets shown in A code example demonstrating the transition from Service Worker syntax to ES Module syntax in Cloudflare Workers. |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-7.text | A code example demonstrating the transition from Service Worker syntax to ES Module syntax using an async function and environment bindings. | Exact payloads, commands, or snippets shown in A code example demonstrating the transition from Service Worker syntax to ES Module syntax using an async function an... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-mig.text | A wrangler configuration file demonstrating the transition from service worker syntax to ES modules for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A wrangler configuration file demonstrating the transition from service worker syntax to ES modules for Cloudflare Wo... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-mig-2.text | A wrangler configuration file demonstrating the schema and variable setup required when migrating from service workers to ES modules. | Exact payloads, commands, or snippets shown in A wrangler configuration file demonstrating the schema and variable setup required when migrating from service worker... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-8.text | A text comparison showing the transition from service worker addEventListener syntax to ES module export syntax for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text comparison showing the transition from service worker addEventListener syntax to ES module export syntax for C... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-mod.text | A text example demonstrating the transition from Service Worker syntax to the ES Module fetch handler structure in Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text example demonstrating the transition from Service Worker syntax to the ES Module fetch handler structure in Cl... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-9.text | A text example demonstrating the syntax transition from Service Worker style to ES Module style using the cloudflare:workers environment import. | Exact payloads, commands, or snippets shown in A text example demonstrating the syntax transition from Service Worker style to ES Module style using the cloudflare:... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-10.text | A code example demonstrating how to transition from Service Worker syntax to ES Modules by importing environment variables from cloudflare:workers. | Exact payloads, commands, or snippets shown in A code example demonstrating how to transition from Service Worker syntax to ES Modules by importing environment vari... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-11.text | A text comparison showing the transformation of a scheduled event listener from the service worker syntax to the ES module syntax. | Exact payloads, commands, or snippets shown in A text comparison showing the transformation of a scheduled event listener from the service worker syntax to the ES m... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-mig-3.text | A text example demonstrating the structural transition from Service Worker syntax to ES Module syntax for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text example demonstrating the structural transition from Service Worker syntax to ES Module syntax for Cloudflare... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-12.text | A text-based comparison showing the transformation of a service worker event listener into an ES module export for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text-based comparison showing the transformation of a service worker event listener into an ES module export for Cl... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-13.text | A text example demonstrating the conversion of a service worker scheduled event handler to an ES module worker format. | Exact payloads, commands, or snippets shown in A text example demonstrating the conversion of a service worker scheduled event handler to an ES module worker format. |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-14.text | A text comparison showing the transition from service worker addEventListener syntax to ES module export default syntax for Cloudflare Workers. | Exact payloads, commands, or snippets shown in A text comparison showing the transition from service worker addEventListener syntax to ES module export default synt... |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-15.text | A text comparison showing the transition from a Service Worker fetch event listener to an ES Module worker format. | Exact payloads, commands, or snippets shown in A text comparison showing the transition from a Service Worker fetch event listener to an ES Module worker format. |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-16.text | A text comparison showing the transformation of a Service Worker fetch event handler into an ES Module worker format. | Exact payloads, commands, or snippets shown in A text comparison showing the transformation of a Service Worker fetch event handler into an ES Module worker format. |
examples/workers-migrate-to-module-from-service-es-modules-cloudflare-workers-ser-17.text | A text comparison showing the transition from a Service Worker fetch event listener to an ES Module worker format. | Exact payloads, commands, or snippets shown in A text comparison showing the transition from a Service Worker fetch event listener to an ES Module worker format. |
What This Skill Covers
- This guide will show you how to migrate your Workers from the Service Worker ↗ format to the ES modules ↗ format.
- Main sections:
Advantages of migrating,Migrate a Worker,Bindings,Bindings in Service Worker format,Bindings in ES modules format.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/reference/migrate-to-module-workers
