← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

Mock Service Worker v3.0 Released with ESM-Only Build, Socket-Based Interception, and GraphQL Subscriptions

🔄 Updated 11h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • MSW v3.0 is now ESM-only, requiring Node.js v22+ and TypeScript 5.9+.
  • GraphQL subscription support added, completing GraphQL coverage.
  • Introduces socket-based network interception in Node.js.
  • Library size reduced, and granular entrypoints are available.

ESM-Only Distribution and Dependency Changes

Mock Service Worker (MSW) version 3.0 is now distributed exclusively as ECMAScript Modules (ESM). This change means Node.js v18 and v20 are no longer supported; users must upgrade to Node.js v22, v24, or v26. The minimum TypeScript version required is now 5.9.

Several transitive dependencies, including graphql, path-to-regexp, picocolors, and statuses, have been removed or made optional. This reduction in dependencies has decreased the library's tarball size from 416KB to 234KB, with type definitions shrinking from 190KB to 90KB. The update also introduces granular entrypoints, replacing a single 'msw' import with protocol-specific paths like 'msw/http' or 'msw/graphql'.

GraphQL Subscription Support

A significant addition in v3.0 is support for GraphQL subscriptions, a feature frequently requested by the community. Building on existing WebSocket interception capabilities, developers can now define subscription handlers using 'graphql.link()' to publish events on demand. This closes the gap in MSW's coverage across HTTP, WebSocket, and GraphQL protocols.

Experimental defineNetwork API

MSW v3.0 introduces an experimental 'defineNetwork' API, intended to replace 'setupServer' and 'setupWorker'. This new primitive separates interception into 'sources' (where traffic originates) and 'handlers' (how requests are answered). This design allows for replaying HAR files, combining custom interceptors, and delegating request timing control to test runners. The '@msw/cloudflare' package is the first to directly expose this API for Workers environments.

Socket-Based Network Interception in Node.js

The most technically significant change is within the underlying Interceptors library. The team has moved network interception in Node.js to the TCP and TLS wraps, which are JavaScript bindings for Node's C-level network code. This new architecture supports arbitrary socket-based protocols, with SMTP cited as an early example. This deep level of interception is described as going as far into the runtime as JavaScript allows without recompiling Node.js itself.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~4 min · 3 stories · Nov 26

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

Mock Service Worker (MSW) released version 3.0, transitioning to an ESM-only build and dropping support for older Node.js versions. The update introduces GraphQL subscription support and a new socket-based network interception algorithm for Node.js, allowing for deeper protocol handling.