- Notifications
You must be signed in to change notification settings - Fork 1k
feat: enable cross-process communication for wrangler dev with multiple configs #10354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 5caa733 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
7110a17 to a7ef4e6 Compare 9c876ab to 17f74f7 Compare a7ef4e6 to 18bd781 Compare 031d1d1 to 4724fcf Compare | 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), | ||
| }) | ||
| ); | ||
| } | ||
| }); |
There was a problem hiding this comment.
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 left a comment
There was a problem hiding this comment.
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?
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 left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 😄
Fixes DEVX-2125
This enables dev registry support when running
wrangler devwith multiple config files.