Skip to content

feat: run as a plugin from the top-level plugins of a multi-configuration - #5765

Open
alexander-akait wants to merge 4 commits into
mainfrom
feat/multi-compiler-plugin-mode
Open

alexander-akait wants to merge 4 commits into
mainfrom
feat/multi-compiler-plugin-mode

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

webpack/webpack#22702 lets a multi-configuration list plugins next to parallelism; webpack applies them once to the MultiCompiler. With the dev server there, one server serves every configuration:

module.exports = Object.assign([appConfig, workerConfig], {
  plugins: [new WebpackDevServer({ port: 8080 })],
});

apply() already handled a MultiCompiler, so this needs no new code path. It now taps MultiCompiler.hooks.shutdown where webpack has it (5.110.0+) and keeps looping over the child compilers on older webpack. The peer range stays ^5.101.0 and webpack is not bumped; the fallback carries a TODO to remove it in the next major.

webpack 5.112.0 ships #22702, and the lockfile is updated to it, so CI runs the top-level plugins test instead of skipping it. MultiCompiler plugin tests:

webpack pass skipped
5.111.1 5 1 (top-level plugins unsupported)
5.112.0 (lockfile) 6 0

The branch is merged with main, including #5750 (dev-middleware 8.4.0 client).

The webpack-cli side (keeping these options under --config-name and extends) is webpack/webpack-cli#4871.

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes, in test/e2e/api-plugin.test.js:

  • serving both configurations from the top-level plugins, with setup, listen and stop each called once. It is skipped on webpack older than 5.112.0 (feature-detected, with a TODO to drop the check in the next major).
  • stopping once on a MultiCompiler without hooks.shutdown, covering the fallback for webpack older than 5.110.0.

Does this PR introduce a breaking change?

No.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

Added "Multiple configurations" to examples/api/plugin/README.md. The webpack.js.org dev-server page could mention it now that webpack 5.112.0 supports top-level plugins.

Use of AI

Written with Claude Code: it made the change and the tests, and ran them against both the released webpack and webpack with #22702, directed and reviewed by the author.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ML8tLtqrJohECUzhdBwqsw


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • A single development server can serve assets from every configuration in a multi-configuration setup when the installed webpack version supports top-level plugins.
  • Bug Fixes
    • Improved server shutdown handling for multi-configuration setups, including cases where the combined compiler does not provide a shutdown hook. The server now stops only once.
  • Documentation
    • Added an example showing how to configure the development server for multiple configurations, including the webpack version requirement for top-level plugins.

Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 662404d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-dev-server Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 90aee5b0-c908-4360-9c9e-b4328a5d3b5b
📥 Commits

Reviewing files that changed from the base of the PR and between 314ef8e and 662404d.

📒 Files selected for processing: 1
  • examples/api/plugin/README.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

Server.apply now registers shutdown on the compiler when its shutdown hook is available. Otherwise, it registers on child compilers. Documentation and tests cover using a top-level Server plugin to serve multiple configurations, including older webpack versions without the MultiCompiler shutdown hook.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 66240

The documented setup lets one server serve multiple configurations, with shutdown paths designed to stop it once. No material merge risk is established.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: enabling webpack-dev-server to run from the top-level plugins list in a multi-configuration setup.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.16%. Comparing base (dc9a72c) to head (662404d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5765   +/-   ##
=======================================
  Coverage   95.15%   95.16%           
=======================================
  Files           6        6           
  Lines        4976     4982    +6     
=======================================
+ Hits         4735     4741    +6     
  Misses        241      241           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

alexander-akait and others added 2 commits October 17, 2026 14:11
5.112.0 applies a multi-configuration's top-level `plugins` to the
MultiCompiler (webpack/webpack#22702), so the test serving both
configurations from there runs instead of being skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
@socket-security

socket-security Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedwebpack@​5.111.1 ⏵ 5.112.081 -121009397 -1100

View full report

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