coderef

JavaScript modules in service workersBaseline · Newly available

The navigator.serviceWorker.register() method accepts { type: "module" } to load scripts that use import and export. Also known as ECMAScript modules or ESM in service workers.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Jan 13, 2026.

Browser support

DesktopChrome
1–90Not supported
91+Supportedsince May 25, 2021
Current: 155
Edge
12–90Not supported
91+Supportedsince May 27, 2021
Current: 154
Firefox
1–146Not supported
147+Supportedsince Jan 13, 2026
Current: 157
Safari
1–14.1Not supported
15+Supportedsince Sep 20, 2021
Current: 27
MobileChrome Android
18–90Not supported
91+Supportedsince May 25, 2021
Current: 155
Firefox Android
4–146Not supported
147+Supportedsince Jan 13, 2026
Current: 157
Safari iOS
1–14.5Not supported
15+Supportedsince Sep 20, 2021
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Jan 13, 2026. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN — see the links below.

Feature detection

JS · check before using
if ("ServiceWorker" in globalThis && "ecmascript_modules" in ServiceWorker.prototype) {
  // ServiceWorker.ecmascript_modules is available
}

Sub-features

Support for each part of the feature (2). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
ServiceWorker.ecmascript_modules9191147159114715
import.service_worker_support9191147159114715