Skip to content

fix: Port change in dev server on reload#2283

Merged
aklinker1 merged 2 commits intomainfrom
fix-port-change-on-reload
Apr 18, 2026
Merged

fix: Port change in dev server on reload#2283
aklinker1 merged 2 commits intomainfrom
fix-port-change-on-reload

Conversation

@aklinker1
Copy link
Copy Markdown
Member

@aklinker1 aklinker1 commented Apr 18, 2026

Overview

Fix yet another regression introduced in v0.20.22... This time we need to modify the config to enforce a consistent port in dev so background changes and server restarts don't change the port.

There was a test covering this case, but it only really tested vite, not the new login in resolveConfig when called a second time... So I added a new one, confirming that it was failing on main.

it('should not change dev server ports when reloading config, even if the port is in-use', async () => {
const project = new TestProject();
await registerWxt('serve', { root: project.root });
const firstPort = wxt.config.dev.server!.port;
expect(firstPort).toBeDefined();
const cleanup = await occupyPort(firstPort);
try {
await wxt.reloadConfig();
const secondPort = wxt.config.dev.server?.port;
expect(secondPort).toBe(firstPort);
} finally {
cleanup();
}
});

Manual Testing

cd packages/wxt-demo
bun dev

Then save the background file. Before, it would try to connect to a new port, now it keeps the same port.

Related Issue

This closes #2282

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 18, 2026

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 13527ec
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/69e38919eaeb1e0008981ff7
😎 Deploy Preview https://deploy-preview-2283--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Apr 18, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.62%. Comparing base (5da6e4f) to head (13527ec).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2283      +/-   ##
==========================================
+ Coverage   79.56%   79.62%   +0.05%     
==========================================
  Files         130      130              
  Lines        3812     3813       +1     
  Branches      865      865              
==========================================
+ Hits         3033     3036       +3     
+ Misses        693      691       -2     
  Partials       86       86              

☔ View full report in Codecov by Sentry.
📢 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.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 18, 2026

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2283

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2283

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2283

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2283

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2283

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2283

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2283

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2283

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2283

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2283

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2283

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2283

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2283

wxt

npm i https://pkg.pr.new/wxt@2283

commit: 13527ec

@aklinker1 aklinker1 merged commit 54fe8c6 into main Apr 18, 2026
21 checks passed
@aklinker1 aklinker1 deleted the fix-port-change-on-reload branch April 18, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension Auto-Reload Breaks Dev Server on Firefox on >=0.20.22

1 participant