Skip to content

fix: support webpack-dev-server 6.x by dropping SockJS instanceof checks - #1046

Open
rtm-ctrlz wants to merge 1 commit into
pmmmwh:mainfrom
rtm-ctrlz:fix/webpack-dev-server-6-sockjs
Open

fix: support webpack-dev-server 6.x by dropping SockJS instanceof checks#1046
rtm-ctrlz wants to merge 1 commit into
pmmmwh:mainfrom
rtm-ctrlz:fix/webpack-dev-server-6-sockjs

Conversation

@rtm-ctrlz

Copy link
Copy Markdown

Summary

webpack-dev-server 6.0.0 removed the SockJS client, but sockets/WDSSocket.js still did a static require('webpack-dev-server/client/clients/SockJSClient') and an instanceof check against it. On WDS 6, that module path no longer resolves, so webpack fails to compile with:

Module not found: Error: Package path ./client/clients/SockJSClient is exported from package
./node_modules/webpack-dev-server, but no valid target file was found
  • Detect the active client via duck-typing on client.sock / client.client instead of instanceof checks against imported client classes. This removes the need to require() a module that may not exist, so there's no compile-time warning/error on any supported WDS version, and it works unchanged across WDS 4/5/6.
  • Widened the webpack-dev-server peer dependency range to ^4.8.0 || 5.x || 6.x.
  • Extended the test harness (webpack-dev-server-v6 dev alias, aliasWDSv6.js) and CI matrix to also run against WDS 6.
  • Updated the supported-versions table in the README.

Test plan

  • yarn lint / yarn format:check
  • Unit tests (yarn test --testPathIgnorePatterns conformance)
  • Conformance tests (yarn test conformance) — all 16 tests pass locally against WDS 4, WDS 5, and WDS 6 (WDS_VERSION=4|5|6)

Fixes #1014

@codesandbox

codesandbox Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@rtm-ctrlz rtm-ctrlz closed this Jul 24, 2026
@rtm-ctrlz
rtm-ctrlz force-pushed the fix/webpack-dev-server-6-sockjs branch from 0e0df87 to 257c43a Compare July 24, 2026 23:00
WDS 6.0.0 removed the SockJSClient module, which broke WDSSocket.js's
require() of it with a compile-time "Module not found" error. Detect
the active client via duck-typing on `.sock`/`.client` instead of
instanceof checks against imported client classes, which works
unchanged across WDS 4/5/6 and needs no optional require.

Also widen the webpack-dev-server peer range to include 6.x and extend
the test harness/CI matrix to cover it.
@rtm-ctrlz rtm-ctrlz reopened this Jul 24, 2026
@pethel

pethel commented Jul 30, 2026

Copy link
Copy Markdown

Thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webpack-dev-server 6.0 dropped support for SockJS

2 participants