Upgrading webpack-dev-server 3 to 4
Breaking3.11.3 → 4.15.2Breaking40Security2New59Fixed112Other1
40 breaking changes and 2 security fixes.
- Rename client.transport to client.webSocketTransport.
- Remove entry options (i.e. hotEntry and needClientEntry) in favor manual setup entries.
- the https.ca option was removed in favor the https.cacert option.
- the dev option was renamed to devMiddleware.
webpack-dev-server publishes an official migration guide for version 4. It covers more than the release notes do.
Migration guide ↗Node.js requirement changed in 4.0.0-beta.3: >= 6.11.5 → >= 12.13.0.
Adds @types/bonjour ^3.5.9, @types/connect-history-api-fallback ^1.3.5, @types/express ^4.17.13, @types/serve-index ^1.9.1, @types/serve-static ^1.13.10, @types/sockjs ^0.3.33, @types/ws ^8.5.5, bonjour-service ^1.0.11, colorette ^2.0.10, default-gateway ^6.0.3, graceful-fs ^4.2.6, ipaddr.js ^2.0.1, launch-editor ^2.6.0, open ^8.0.9, rimraf ^3.0.2.
Drops bonjour, debug, del, import-local, internal-ip, ip, is-absolute-url, killable, loglevel, opn, portfinder, semver, sockjs-client, strip-ansi, supports-color, url, webpack-log, yargs.
Installs 217 packages in all (was 398).
Also installs @types/body-parser, @types/connect, @types/express-serve-static-core, @types/http-errors, @types/http-proxy, @types/json-schema, @types/mime, @types/node-forge, @types/qs, @types/range-parser, @types/retry, @types/send, ajv-formats, define-lazy-prop, fast-uri and 13 more.
No longer installs @isaacs/nonrecursive-glob-match, @types/glob, @types/minimatch, ajv-errors, ansi-colors, ansi-regex, ansi-styles, arr-diff, arr-flatten, arr-union, array-union, array-uniq, array-unique, assign-symbols, async and 137 more.
Moves ajv 6.15.0 → 8.20.0, ajv-keywords 3.5.2 → 5.1.0, anymatch 2.0.0 → 3.1.3, array-flatten 1.1.1, 2.1.2 → 1.1.1, balanced-match 1.0.2, 4.0.4 → 1.0.2, binary-extensions 1.13.1 → 2.3.0, brace-expansion 1.1.21, 5.0.12 → 1.1.21, braces 2.3.2 → 3.0.3, chokidar 2.1.8 → 3.6.0, connect-history-api-fallback 1.6.0 → 2.0.0, cross-spawn 6.0.6 → 7.0.6, debug 2.6.9, 3.2.7, 4.4.3 → 2.6.9, 4.4.3, default-gateway 4.2.0 → 6.0.3, execa 1.0.0 → 5.1.1, fill-range 4.0.0 → 7.1.1 and 32 more. Your build may pick other versions.
What you must change
client.transportclient.webSocketTransporthotEntryneedClientEntryhttps.cahttps.cacertdevdevMiddlewareclient.overlaytruewebpack-dev-serverwebpack-cliopenPage--open-page[URL]hostuseLocalIplocal-ipv4local-ipv6stdin--watch-options-stdininjectClientinjectHotclient.needClientEntryclient.needHotEntry--hot-onlystaticpath.resolve(process.cwd(), 'public')path.resolve(process.cwd(), 'static')Node.js@6Node.js@8Node.jsNode@10hottruehotOnlytransportModesockjswsbeforeaftersetuponBeforeSetupMiddlewareonAfterSetupMiddlewareclientOptionsclientsockHostsockPathsockPortclientinlineiframelazyfilenamefeaturesloglogLevellogTimenoInfoquietreporterstatswebpack.config.jssocketcontentBasecontentBasePublicPathserveIndexstaticOptionswatchContentBasewatchOptionsdisableHostCheckallowedHostsfirewallprofilelocation.portclient.portlocation.hostnameclient.hostthis.webSocketServer.clientsresethostportnulloverlayclientkeycertpfxpfx-passphrasecacertcafsindexmimeTypespublicPathserverSideRenderwriteToDiskwebpack-dev-middlewareserver.listen()portprogressclientwebpack-dev-middlewareselfsigned