Skip to content

fix: handle middleware teardown in plugin mode#5703

Merged
bjohansebas merged 3 commits into
mainfrom
fix-plugin-teardown-middleware-close
Jul 3, 2026
Merged

fix: handle middleware teardown in plugin mode#5703
bjohansebas merged 3 commits into
mainfrom
fix-plugin-teardown-middleware-close

Conversation

@bjohansebas

Copy link
Copy Markdown
Member

…n compiler close

Summary

What kind of change does this PR introduce?

Did you add tests for your changes?

Does this PR introduce a breaking change?

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

Use of AI

Copilot AI review requested due to automatic review settings July 2, 2026 21:29
@changeset-bot

changeset-bot Bot commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 395b6cd

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 no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.54545% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.38%. Comparing base (c2d23a7) to head (395b6cd).

Files with missing lines Patch % Lines
lib/Server.js 94.54% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5703      +/-   ##
==========================================
+ Coverage   82.90%   89.38%   +6.47%     
==========================================
  Files          13       13              
  Lines        6126     6169      +43     
==========================================
+ Hits         5079     5514     +435     
+ Misses       1047      655     -392     

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

Copilot AI 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.

Pull request overview

This PR fixes teardown behavior when webpack-dev-server is used in plugin mode (server.apply(compiler)), ensuring compiler.close() does not surface an error due to dev-middleware shutdown semantics in that mode.

Changes:

  • Skip calling webpack-dev-middleware’s close() during Server.stop() when running in plugin mode (this.isPlugin).
  • Add an e2e regression test that asserts compiler.close() completes without returning an error in plugin mode.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/e2e/api-plugin.test.js Adds a regression test validating compiler.close() returns no error in plugin mode.
lib/Server.js Avoids calling middleware.close() during teardown when Server is operating as a plugin (apply() mode).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bjohansebas bjohansebas marked this pull request as draft July 2, 2026 21:46
@bjohansebas bjohansebas marked this pull request as ready for review July 3, 2026 02:59
Copilot AI review requested due to automatic review settings July 3, 2026 02:59

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bjohansebas bjohansebas merged commit a451839 into main Jul 3, 2026
67 of 115 checks passed
@bjohansebas bjohansebas deleted the fix-plugin-teardown-middleware-close branch July 3, 2026 03:10
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.

2 participants