Skip to content

refactor: one hot.inject enum for what is added to the compilation - #2484

Merged
alexander-akait merged 4 commits into
mainfrom
claude/webpack-dev-server-pr-consolidation-t0k72z
Oct 17, 2026
Merged

alexander-akait merged 4 commits into
mainfrom
claude/webpack-dev-server-pr-consolidation-t0k72z

Conversation

@alexander-akait

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

Copy link
Copy Markdown
Member

hot.inject (boolean) and hot.client: false were two overlapping switches: inject: false dropped both the runtime and HotModuleReplacementPlugin, while client: false dropped only the runtime. This replaces both with one enum. Neither option has shipped yet, so nothing released breaks.

hot.inject Runtime (client + overlay) HotModuleReplacementPlugin For
"all" (default) ✓ ✓ nothing to add to the webpack configuration
"plugin" ✓ a page that wires a client of its own
"client" ✓ a configuration that applies the plugin itself
"none" wiring both yourself, or using the endpoint only through subscribe
  • hot.client now takes options only. hot.inject: true/false and hot.client: false fail validation with the valid values listed.
  • "client" is new: the runtime is added without the plugin, and a plugin in the configuration is kept without the "redundant plugin" warning.
  • The hot.token requirement is turned off whenever no client is added ("plugin" / "none"), as inject: false did before.
  • hot.client.transport still names a wire ("sse"/"ws") or a module exporting a client class: the first commit split the module out into hot.client.module, and the second reverts that, so there stays a single option.

Tests

  • Unit tests for every mode, a plugin of your own under "client", and validation cases for the enum and for the old shapes. Existing uses are mapped (inject: false → "none", client: false → "plugin").
  • e2e: "client" with the configuration's own plugin applies updates in place; "client" with no plugin connects and leaves module.hot undefined.
  • Locally: unit 7377 of 7379 (the other two expect a writeToDisk EACCES, which root never gets); e2e 233 of 233; lint, types and schema check clean.
  • webpack-dev-server #5750 maps its client: false to "plugin" with hot and "none" without, on a build of this branch: its full suite shows the same sandbox-only failures as before.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • hot.inject supports "all", "plugin", "client", and "none" modes to control whether the browser client, HMR plugin, both, or neither are added.
    • "client" mode can add the browser client while preserving an HMR plugin already configured in your project.
    • Token requirements depend on whether the selected mode adds a client.
  • Documentation
    • Updated configuration guidance to explain the injection modes and their effects.

alexander-akait and others added 2 commits October 16, 2026 11:53
…half

`hot.client.transport` names only the wire now; a module exporting a
client class of your own goes in the new `hot.client.module`. `hot.inject`
switches only `HotModuleReplacementPlugin`, and `hot.client: false` only
the runtime in the page, so the two no longer overlap; both off adds
nothing, as `inject: false` alone did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
Reverts the `hot.client.module` split, so `hot.client.transport` names a
wire or a client module as before. `hot.inject` becomes
"all" | "plugin" | "client" | "none" — the runtime (client and overlay),
HotModuleReplacementPlugin, both or neither — replacing the boolean and
`hot.client: false`, so one option says what goes in.

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

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: ca03931

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

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

Click here to learn what changesets are, and how to add one.

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

@coderabbitai

coderabbitai Bot commented Oct 16, 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: 781d8a6c-c8fa-42e1-a6fa-ceb36d422e4c
📥 Commits

Reviewing files that changed from the base of the PR and between b0f931f and ca03931.

📒 Files selected for processing: 3
  • README.md
  • src/utils.js
  • test/inject-client.test.js
🚧 Files skipped from review as they are similar to previous changes: 3
  • test/inject-client.test.js
  • README.md
  • src/utils.js

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

hot.inject now accepts "all", "plugin", "client", or "none" to select whether the middleware adds the client runtime and the HMR plugin. hot.client: false is no longer accepted. Token resolution, option validation, and TypeScript declarations reflect these modes. Unit and end-to-end tests cover the mode behavior.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to ca039

The injection-mode change is mergeable after normal checks; no concrete outstanding behavior issue 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 summarizes the main change: replacing overlapping hot injection switches with one hot.inject enum that controls what is added to the compilation.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 10 files. (1 skipped: 1…
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

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 10 files. (1 skipped: 1 unsupported.)

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

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/inject-client.test.js

Oops! Something went wrong! :(

ESLint: 9.39.5

Error: Error while loading rule 'jest/no-deprecated-functions': Unable to detect Jest version - please ensure jest package is installed, or otherwise set version explicitly
Occurred while linting /test/inject-client.test.js
at detectJestVersion (/.eslint-tmp/node_modules/eslint-plugin-jest/lib/rules/utils/detectJestVersion.js:22:9)
at create (/.eslint-tmp/node_modules/eslint-plugin-jest/lib/rules/no-deprecated-functions.js:31:107)
at Object.create (/.eslint-tmp/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js:39:20)
at createRuleListeners (/.eslint-tmp/node_modules/eslint/lib/linter/linter.js:1019:15)
at /.eslint-tmp/node_modules/eslint/lib/linter/linter.js:1151:7
at Array.forEach ()
at runRules (/.eslint-tmp/node_modules/eslint/lib/linter/linter.js:1085:31)
at #flatVerifyWithoutProcessors (/.eslint-tmp/node_modules/eslint/lib/linter/linter.js:2115:4)
at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/.eslint-tmp/node_modules/eslint/lib/linter/linter.js:2203:43)
at Linter._verifyWithFlatConfigArray (/.eslint-tmp/node_modules/eslint/lib/linter/linter.js:2306:15)

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e50564b5-1fb0-4ec2-b14b-083cd7848913
📥 Commits

Reviewing files that changed from the base of the PR and between f9ad683 and b0f931f.

📒 Files selected for processing: 16
  • .changeset/finish-dev-server-migration.md
  • .changeset/hot-inject.md
  • README.md
  • src/hot.js
  • src/options.check.js
  • src/options.json
  • src/utils.js
  • test/__snapshots__/validation-options.test.js.snap.webpack5
  • test/e2e/inject.test.js
  • test/e2e/messages.test.js
  • test/e2e/process-update.test.js
  • test/inject-client.test.js
  • test/universal-target.test.js
  • test/validation-options.test.js
  • types/hot.d.ts
  • types/utils.d.ts

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

Comment thread README.md Outdated
Comment thread src/utils.js Outdated
Comment thread src/utils.js
…says

`apply` is the injected client's mode, so it only leaves the plugin out
when a client is added. The transport-function warning no longer says the
plugin is applied under "client", and the README says the "plugin" and
"none" modes turn off only the default token requirement.

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

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.59%. Comparing base (f9ad683) to head (ca03931).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2484   +/-   ##
=======================================
  Coverage   96.58%   96.59%           
=======================================
  Files          24       24           
  Lines        2637     2640    +3     
=======================================
+ Hits         2547     2550    +3     
  Misses         90       90           

☔ 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.

Copy link
Copy Markdown
Member Author

codecov/project is red at 96.55% (−0.04%, one more missed line). That line isn't in this diff: codecov/patch reports 100% of the changed lines hit, and unit-test coverage of main and this branch, compared locally, misses exactly the same 777 lines. What's left is the browser-measured client coverage, which moves between runs without a code change: #2476's head measured 96.66% and main at f9ad683, with only dependency bumps since, measures 96.58%. Re-running the workflow once to confirm. codecov/project is not a required check.


Generated by Claude Code

@alexander-akait
alexander-akait merged commit f084ec9 into main Oct 17, 2026
39 checks passed
@alexander-akait
alexander-akait deleted the claude/webpack-dev-server-pr-consolidation-t0k72z branch October 17, 2026 10:40
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