diff --git a/.cspell.json b/.cspell.json
new file mode 100644
index 0000000000..1976882978
--- /dev/null
+++ b/.cspell.json
@@ -0,0 +1,88 @@
+{
+ "version": "0.2",
+ "language": "en,en-gb",
+ "words": [
+ "apos",
+ "camelcase",
+ "tapable",
+ "sockjs",
+ "spdy",
+ "memfs",
+ "execa",
+ "networkidle",
+ "ipaddr",
+ "pageerror",
+ "unmock",
+ "testhost",
+ "USEPOLLING",
+ "colorette",
+ "selfsigned",
+ "portfinder",
+ "xlink",
+ "instanceof",
+ "Heyo",
+ "domcontentloaded",
+ "historyapifallback",
+ "pems",
+ "localdomain",
+ "unshift",
+ "Zeroconf",
+ "webworker",
+ "devserver",
+ "logspam",
+ "Sindre",
+ "Sorhus",
+ "esmodules",
+ "CAFC",
+ "FACCA",
+ "darkgrey",
+ "Consolas",
+ "peerigon",
+ "Ichigo",
+ "Kurosaki",
+ "typeof",
+ "parseable",
+ "proxyfalse",
+ "klona",
+ "sessionattached",
+ "zenitsu",
+ "chuntaro",
+ "nwjs",
+ "myhost",
+ "ƕrrn",
+ "Fƅsq",
+ "G'RД",
+ "ECONNREFUSED",
+ "taskkill",
+ "testhouse",
+ "mwarn",
+ "mansi",
+ "nosources",
+ "Heyyy",
+ "oipqj",
+ "breakpad",
+ "infobars",
+ "omnibox",
+ "swiftshader",
+ "hoge",
+ "subsubcomain",
+ "noselect",
+ "commitlint",
+ "eslintcache",
+ "hono",
+ "privkey",
+ "geomanist"
+ ],
+ "ignorePaths": [
+ "CHANGELOG.md",
+ "coverage",
+ "package.json",
+ "dist/**",
+ "client/**",
+ "**/__snapshots__/**",
+ "package-lock.json",
+ "node_modules",
+ "coverage",
+ "*.log"
+ ]
+}
diff --git a/.eslintignore b/.eslintignore
index 861faf369b..9bc9ffb002 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -3,3 +3,6 @@
!/test/client
coverage
node_modules
+examples/**/main.js
+examples/client/trusted-types-overlay/app.js
+test/fixtures/reload-config/foo.js
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 8505d9a5fd..2db9dc995b 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -8,3 +8,7 @@ updates:
timezone: Europe/Berlin
open-pull-requests-limit: 10
versioning-strategy: lockfile-only
+ groups:
+ dependencies:
+ patterns:
+ - "*"
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 24a35a06ad..8caf799d12 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -9,6 +9,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: "Dependency Review"
- uses: actions/dependency-review-action@v3
+ uses: actions/dependency-review-action@v4
diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml
index 80946bd2c9..d6ef806925 100644
--- a/.github/workflows/nodejs.yml
+++ b/.github/workflows/nodejs.yml
@@ -59,8 +59,9 @@ jobs:
- name: Security audit
run: npm audit --production
- - name: Check commit message
- uses: wagoid/commitlint-github-action@v5
+ - name: Validate PR commits with commitlint
+ if: github.event_name == 'pull_request'
+ run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
test:
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }} (${{ matrix.shard }})
@@ -68,7 +69,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
- node-version: [18.x, 20.x, 21.x]
+ node-version: [18.x, 20.x, 22.x, 23.x]
shard: ["1/4", "2/4", "3/4", "4/4"]
webpack-version: [latest]
@@ -119,6 +120,6 @@ jobs:
if: matrix.node-version != '18.x'
- name: Submit coverage data to codecov
- uses: codecov/codecov-action@v3
+ uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 2245f4db71..de3b694aec 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,9 +14,11 @@ yarn.lock
yarn-error.log
.eslintcache
+.cspellcache
test/fixtures/static-config/public/assets/non-exist.txt
test/fixtures/watch-files-config/public/assets/non-exist.txt
test/fixtures/reload-config/main.css
test/fixtures/reload-config-2/main.css
+test/fixtures/worker-config-dev-server-false/public
!/test/fixtures/static-config/public/node_modules
diff --git a/.husky/commit-msg b/.husky/commit-msg
index fd2bf708ee..dbce4f4cf4 100755
--- a/.husky/commit-msg
+++ b/.husky/commit-msg
@@ -1 +1 @@
-npx --no-install commitlint --edit $1
+commitlint --edit $1
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 2312dc587f..c27d8893a9 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1 +1 @@
-npx lint-staged
+lint-staged
diff --git a/.prettierignore b/.prettierignore
index 236cbcb571..65cd2f21a9 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -3,3 +3,4 @@
coverage
node_modules
CHANGELOG.md
+examples/client/trusted-types-overlay/app.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f6f967b8a..1845e61878 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,80 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+## [5.2.1](https://github.com/webpack/webpack-dev-server/compare/v5.2.0...v6.0.0) (2025-03-26)
+
+### Security
+
+* cross-origin requests are not allowed unless allowed by `Access-Control-Allow-Origin` header
+* requests with an IP addresses in the `Origin` header are not allowed to connect to WebSocket server unless configured by `allowedHosts` or it different from the `Host` header
+
+The above changes may make the dev server not work if you relied on such behavior, but unfortunately they carry security risks, so they were considered as fixes.
+
+### Bug Fixes
+
+* prevent overlay for errors caught by React error boundaries ([#5431](https://github.com/webpack/webpack-dev-server/issues/5431)) ([8c1abc9](https://github.com/webpack/webpack-dev-server/commit/8c1abc903ab444d9ce99e567b9a6c603e1ec06be))
+* take the first network found instead of the last one, this restores the same behavior as 5.0.4 ([#5411](https://github.com/webpack/webpack-dev-server/issues/5411)) ([ffd0b86](https://github.com/webpack/webpack-dev-server/commit/ffd0b86b790d372f90e17aea92cfd9def83fee96))
+
+## [5.2.0](https://github.com/webpack/webpack-dev-server/compare/v5.1.0...v5.2.0) (2024-12-11)
+
+
+### Features
+
+* added `getClientEntry` and `getClientHotEntry` methods to get clients entries ([dc642a8](https://github.com/webpack/webpack-dev-server/commit/dc642a832d45c23c5c7a08fbf29995e0db7e0d95))
+
+
+### Bug Fixes
+
+* speed up initial client bundling ([145b5d0](https://github.com/webpack/webpack-dev-server/commit/145b5d01610a16468fc32719a20366682b0e8572))
+
+## [5.1.0](https://github.com/webpack/webpack-dev-server/compare/v5.0.4...v5.1.0) (2024-09-03)
+
+
+### Features
+
+* add visual progress indicators ([a8f40b7](https://github.com/webpack/webpack-dev-server/commit/a8f40b74e6439a8281b9fe8868eb9db7e4c5de50))
+* added the `app` option to be `Function` (by default only with `connect` compatibility frameworks) ([3096148](https://github.com/webpack/webpack-dev-server/commit/3096148746c906105c4424352f5b5ad1bff0fd4f))
+* allow the `server` option to be `Function` ([#5275](https://github.com/webpack/webpack-dev-server/issues/5275)) ([02a1c6d](https://github.com/webpack/webpack-dev-server/commit/02a1c6d788f5fc47c11cc7d910fd1b5e17aed886))
+* http2 support for `connect` and `connect` compatibility frameworks which support HTTP2 ([#5267](https://github.com/webpack/webpack-dev-server/issues/5267)) ([6509a3f](https://github.com/webpack/webpack-dev-server/commit/6509a3fd3eb5decb61f60a9f2db97d76f71ecb99))
+
+
+### Bug Fixes
+
+* check the `platform` property to determinate the target ([#5269](https://github.com/webpack/webpack-dev-server/issues/5269)) ([c3b532c](https://github.com/webpack/webpack-dev-server/commit/c3b532c6360317319793dcda22c76fbfc05fbdcf))
+* ipv6 output ([#5270](https://github.com/webpack/webpack-dev-server/issues/5270)) ([06005e7](https://github.com/webpack/webpack-dev-server/commit/06005e7cb99e4c412b968ed3fb786acfb8c2e037))
+* replace `rimraf` with `rm` ([#5162](https://github.com/webpack/webpack-dev-server/issues/5162)) ([1a1561f](https://github.com/webpack/webpack-dev-server/commit/1a1561f09bdfa7a98434d7d9cd62e323b887dfbf))
+* replace default gateway ([#5255](https://github.com/webpack/webpack-dev-server/issues/5255)) ([f5f0902](https://github.com/webpack/webpack-dev-server/commit/f5f09024ff4fe6625aa94bcd69439462d74013f0))
+* support `devServer: false` ([#5272](https://github.com/webpack/webpack-dev-server/issues/5272)) ([8b341cb](https://github.com/webpack/webpack-dev-server/commit/8b341cb8c1dc01cef62c70959620cd0cbd87fee7))
+
+### [5.0.4](https://github.com/webpack/webpack-dev-server/compare/v5.0.3...v5.0.4) (2024-03-19)
+
+
+### Bug Fixes
+
+* **security:** bump webpack-dev-middleware ([#5112](https://github.com/webpack/webpack-dev-server/issues/5112)) ([aab576a](https://github.com/webpack/webpack-dev-server/commit/aab576a9e4930a1731e8b0380c859552fc9a6e11))
+
+### [5.0.3](https://github.com/webpack/webpack-dev-server/compare/v5.0.2...v5.0.3) (2024-03-12)
+
+
+### Bug Fixes
+
+* **types:** proxy ([#5101](https://github.com/webpack/webpack-dev-server/issues/5101)) ([6e1aed3](https://github.com/webpack/webpack-dev-server/commit/6e1aed30ffd6456935b4fe22851cd560b0eae176))
+
+### [5.0.2](https://github.com/webpack/webpack-dev-server/compare/v5.0.1...v5.0.2) (2024-02-16)
+
+
+### Bug Fixes
+
+* types ([#5057](https://github.com/webpack/webpack-dev-server/issues/5057)) ([da2c24d](https://github.com/webpack/webpack-dev-server/commit/da2c24ddd92198a1337553457eedcece6af38195))
+
+### [5.0.1](https://github.com/webpack/webpack-dev-server/compare/v5.0.0...v5.0.1) (2024-02-13)
+
+
+### Bug Fixes
+
+* avoid using eval in client ([#5045](https://github.com/webpack/webpack-dev-server/issues/5045)) ([7681477](https://github.com/webpack/webpack-dev-server/commit/76814771dcebe80628b4462f5e1d30064ae226d5))
+* overlay and `require-trusted-types-for` ([#5046](https://github.com/webpack/webpack-dev-server/issues/5046)) ([e115436](https://github.com/webpack/webpack-dev-server/commit/e11543677120b004d1f20e11fdf34c07897c7b0c))
+
## [5.0.0](https://github.com/webpack/webpack-dev-server/compare/v4.15.1...v5.0.0) (2024-02-12)
[Migration Guide and Changes](https://github.com/webpack/webpack-dev-server/blob/master/migration-v5.md).
diff --git a/README.md b/README.md
index b432c7aaf5..e8ceea5f5f 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
[![node][node]][node-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
-[![chat][chat]][chat-url]
+[![discussion][discussion]][discussion-url]
[![downloads][downloads]][npm-url]
[![contributors][contributors]][contributors-url]
@@ -190,7 +190,7 @@ CLI documentation: https://webpack.js.org/api/cli/.
Made with ♥ by the webpack team.
```
-> **Note**
+> [!NOTE]
>
> _Detailed documentation for above options is available on this [link](https://webpack.js.org/configuration/dev-server/)._
@@ -279,7 +279,7 @@ Your first-stop-shop for support for webpack-dev-server should be the excellent
of those docs, please head over to the [webpack.js.org repo][wjo-url] and open a
pull request.
-From there, we encourage users to visit the [webpack Gitter chat][chat-url] and
+From there, we encourage users to visit the [webpack discussions][discussion-url] and
talk to the fine folks there. If your quest for answers comes up dry in chat,
head over to [StackOverflow][stack-url] and do a quick search or open a new
question. Remember; It's always much easier to answer questions that include your
@@ -313,8 +313,8 @@ This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/
[tests-url]: https://github.com/webpack/webpack-dev-server/actions?query=workflow%3Awebpack-dev-server
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
-[chat]: https://badges.gitter.im/webpack/webpack.svg
-[chat-url]: https://gitter.im/webpack/webpack
+[discussion]: https://img.shields.io/github/discussions/webpack/webpack
+[discussion-url]: https://github.com/webpack/webpack/discussions
[docs-url]: https://webpack.js.org/configuration/dev-server/#devserver
[hash-url]: https://twitter.com/search?q=webpack
[middleware-url]: https://github.com/webpack/webpack-dev-middleware
diff --git a/client-src/index.js b/client-src/index.js
index 4523ef845c..c9ea5d1233 100644
--- a/client-src/index.js
+++ b/client-src/index.js
@@ -1,14 +1,12 @@
/* global __resourceQuery, __webpack_hash__ */
///