Skip to content

feat: enable cross-process communication for wrangler dev with multiple configs#10354

Merged
edmundhung merged 2 commits into
mainfrom
edmundhung/DEVX-2125
Aug 20, 2025
Merged

feat: enable cross-process communication for wrangler dev with multiple configs#10354
edmundhung merged 2 commits into
mainfrom
edmundhung/DEVX-2125

Conversation

@edmundhung

@edmundhung edmundhung commented Aug 13, 2025

Copy link
Copy Markdown
Member

Fixes DEVX-2125

This enables dev registry support when running wrangler dev with multiple config files.


@changeset-bot

changeset-bot Bot commented Aug 13, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5caa733

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Major
@cloudflare/vitest-pool-workers Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2025

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10354

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10354

miniflare

npm i https://pkg.pr.new/miniflare@10354

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10354

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10354

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10354

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@10354

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@10354

wrangler

npm i https://pkg.pr.new/wrangler@10354

commit: 5caa733

@edmundhung edmundhung force-pushed the edmundhung/DEVX-2125 branch from 7110a17 to a7ef4e6 Compare August 13, 2025 13:36
@edmundhung edmundhung force-pushed the edmundhung/DEVX-2124 branch from 9c876ab to 17f74f7 Compare August 13, 2025 20:15
Base automatically changed from edmundhung/DEVX-2124 to main August 19, 2025 10:55
@edmundhung edmundhung force-pushed the edmundhung/DEVX-2125 branch from a7ef4e6 to 18bd781 Compare August 19, 2025 12:39
@edmundhung edmundhung force-pushed the edmundhung/DEVX-2125 branch from 031d1d1 to 4724fcf Compare August 19, 2025 15:38
@edmundhung edmundhung marked this pull request as ready for review August 19, 2025 16:52
@edmundhung edmundhung requested a review from a team as a code owner August 19, 2025 16:52
Comment on lines +635 to +658
const [primaryDevEnv, ...secondary] = Array.isArray(devEnv)
? devEnv
: [devEnv];

// The ProxyWorker will have a stable host and port, so only listen for the first update
void primaryDevEnv.proxy.ready.promise.then(({ url }) => {
if (args.onReady) {
args.onReady(url.hostname, parseInt(url.port));
}

if (
(args.enableIpc || !args.onReady) &&
process.send &&
typeof vitest === "undefined"
) {
process.send(
JSON.stringify({
event: "DEV_SERVER_READY",
ip: url.hostname,
port: parseInt(url.port),
})
);
}
});

@edmundhung edmundhung Aug 19, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I moved this out so that runWranglerDev can wait for the IPC message properly when providing multiple configs.

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Amazing stuff 🫶

Anyways, I think we don't have any test that shows that multi config wrangler dev workers can communicate with vite workers, do we? Would that by a big lift to test?

Comment thread fixtures/dev-registry/workers/module-worker.ts
@edmundhung

Copy link
Copy Markdown
Member Author

Anyways, I think we don't have any test that shows that multi config wrangler dev workers can communicate with vite workers, do we? Would that by a big lift to test?

I felt adding a whole new set of tests just for multi-config would be repetitive, so I updated some of the existing tests in 5caa733 to use a multi-config setup instead. That way we still get a bit more coverage without duplicating too much.

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me 😄

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Aug 20, 2025
@edmundhung edmundhung merged commit da40571 into main Aug 20, 2025
55 of 58 checks passed
@edmundhung edmundhung deleted the edmundhung/DEVX-2125 branch August 20, 2025 15:31
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants