You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add plugin support
Allow webpack-dev-server to run as a webpack plugin. The server can now
be created without explicitly passing a compiler, integrates with the
compiler lifecycle to prevent multiple starts on recompilation, ensures
clean shutdown, and supports MultiCompiler setups with multiple
independent plugin servers.
* test: add tests for plugin support
Add e2e coverage for the plugin API (api-plugin.test.js), MultiCompiler
and multiple independent plugin servers, build-mode behavior, and
related logging snapshots. Add the compile helper and port mappings used
by these tests.
* docs: add example for using webpack-dev-server as a plugin
Add a runnable example (app, webpack config and README) showing how to
configure and use webpack-dev-server as a webpack plugin.
* chore: add changeset for plugin support
* test: add test for in-memory file system behavior in plugin
* refactor: update hooks to use watchRun instead of beforeCompile for better handling of compiler events
* test: add hot module replacement tests for plugin API
* test: enhance output.clean behavior test for in-memory asset serving
* test: log listen() failure instead of throwing in server setup
* refactor: update constructor to make compiler parameter optional for plugin usage
Add plugin support. `webpack-dev-server` can now be used as a webpack plugin, integrating with the compiler lifecycle without explicitly passing a compiler, preventing multiple server starts on recompilation, ensuring clean shutdown, and supporting `MultiCompiler` setups with multiple independent plugin servers.
1. Open `http://localhost:8080/` in your preferred browser.
35
+
2. You should see the text on the page itself change to read `Success!`.
36
+
3. Press `Ctrl+C` in the terminal — `webpack-cli` closes the compiler, which
37
+
fires the plugin's `shutdown` hook, stopping the dev server cleanly.
38
+
39
+
## Notes
40
+
41
+
- The plugin works with both `webpack --watch` and `webpack serve`. With
42
+
`webpack serve`, `webpack-cli` already creates its own standalone dev server
43
+
for the same compiler, so you would end up with two servers running. If
44
+
that's intentional (e.g. different ports/hosts), make sure the plugin's
45
+
`port` does not clash with the one `webpack-cli` resolves from
46
+
`config.devServer` and CLI args. Otherwise prefer one or the other.
0 commit comments