Widely availableA strong default for modern worker code when your target browsers support module workers.

Overview

Module workers let Web Workers use standard ES module imports and exports. They make worker code easier to structure, share, and maintain than older script-style worker setups.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
api.Worker.Worker.ecmascript_modules
80
80
114
15
80
15
DOM API
Worker (options type parameter)

`options.type` parameter

80
80
114
15
80
15
Operator
worker support

Available in workers

80
80
114
15
80
15
Statement
worker support

Available in workers

80
80
114
15
80
15
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 2 item(s)
Implementation note
  • Nested workers support was introduced in Safari 15.5.
  • Script loading in nested workers was introduced in Safari 16.4.
Notes 2 item(s)
Implementation note
  • Nested workers support was introduced in Safari on iOS 15.5.
  • Script loading in nested workers was introduced in Safari on iOS 16.4.

Syntax

JAVASCRIPT
const worker = new Worker('worker.js', { type: 'module' });

// Inside worker.js
import { process } from './utils.js';
process(data);

Use cases

  • Shared worker utilities

    Import parsing, math, or formatting helpers directly into worker code instead of bundling everything into one file.

  • Heavy background tasks

    Keep CPU-intensive work off the main thread while preserving a clean module structure.

Cautions

  • Worker execution still has different global APIs and loading constraints from the main thread, even when modules are supported.
  • Check bundling and deployment paths carefully because worker URLs and module resolution must still line up.

Accessibility

  • Moving work into a worker can improve responsiveness, which directly helps keyboard and assistive technology users.
  • Performance gains do not replace the need for clear loading states when background work affects visible UI.

Powered by web-features