Skip to content

Upgrade webpack-dev-server to 6 to drop sockjs / websocket-driver (8.18.0) - #433

Draft
redbugz wants to merge 1 commit into
frontierMasterfrom
chore/webpack-dev-server-6
Draft

redbugz wants to merge 1 commit into
frontierMasterfrom
chore/webpack-dev-server-6

Conversation

@redbugz

@redbugz redbugz commented Nov 19, 2026

Copy link
Copy Markdown

Removes sockjs, faye-websocket, websocket-driver and websocket-extensions from @fs/react-scripts' dependency tree by upgrading webpack-dev-server from 4 to 6. Apps can then drop the "websocket-driver": "^0.8.0" override they added when Artifactory started blocking websocket-driver 0.7.x.

Some apps must keep the override. Anything else that pulls in WDS 4 or 5 still brings sockjs back. frontier-app-react is one: @storybook/preset-create-react-app depends on upstream react-scripts@5.0.1. Check with npm ls sockjs before removing it.

Config changes required by WDS 5 and 6

  • https → server, and onBefore/AfterSetupMiddleware → setupMiddlewares. WDS's host checks still run before src/setupProxy.js, as in WDS 4.
  • setupProxy.js still gets Express 4. WDS 6 runs on Express 5, which rejects routes like snow's app.post('*'). Without this, every snow app's dev server fails to start. setupProxy.js now gets its own Express 4 app, mounted inside the dev server's. Adds express@^4.22.0.
  • package.json proxy handlers move under on. http-proxy-middleware v4 silently ignores the old onProxyReq/onError keys.
  • .cjs excluded from the asset loader. WDS 6's hot reload client imports .cjs files, which otherwise compile as asset URLs and fail.
  • npm start reports startup failures and exits, instead of hanging silently. Ctrl+C uses stopCallback (close() was removed).
  • webpack range raised to ^5.101.0 (WDS 6 peer). Node >=24 already satisfies WDS 6.

Version 8.18.0. The lockfile only adds and removes WDS's own dependencies; no existing package changes version.

Verified against frontier-app-react

Packed this branch, installed it in a frontier-app-react worktree, and removed the websocket-driver override:

  • npm start compiles, and snow serves the app on :5006.
  • Hot reload works: editing a component updated the page without a reload.
  • The error overlay appears for a syntax error and clears when it's fixed.
  • Ctrl+C exits in about 2s.
  • npm run build passes.
  • Jest: 41 passed, 2 skipped. Cypress component: 4/4 pass.
  • Cold-cache npm ci through Artifactory: a minimal app depending only on @fs/react-scripts installs with no 403s and no sockjs. frontier-app-react still 403s on websocket-driver@0.7.5 because of the storybook preset above.

Not tested: HTTPS=true and the package.json proxy field. frontier-app-react uses neither.

🤖 Generated with Claude Code

Artifactory curation blocks websocket-driver 0.7.x, which sockjs@0.3.24
(via webpack-dev-server 4 and 5) requires. WDS 6 uses only ws.

- https -> server; onBefore/AfterSetupMiddleware -> setupMiddlewares,
  keeping WDS host checks ahead of src/setupProxy.js
- give setupProxy.js its own Express 4 app: WDS 6's Express 5 router
  rejects snow's app.post('*') and the dev server never starts
- map prepareProxy's onProxyReq/onError to http-proxy-middleware v4 `on`
- exclude .cjs from the asset fallback; the WDS 6 HMR client imports .cjs
- report dev server start errors; use stopCallback (close() was removed)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant