diff --git a/.changeset/tricky-bottles-bow.md b/.changeset/tricky-bottles-bow.md new file mode 100644 index 000000000000..4cf91d81f0e7 --- /dev/null +++ b/.changeset/tricky-bottles-bow.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +Default the file based registry (`--x-registry`) to on. This should improve stability of multi-worker development diff --git a/packages/wrangler/e2e/dev-registry.test.ts b/packages/wrangler/e2e/dev-registry.test.ts index aab29e3edb72..e1f0ce908c83 100644 --- a/packages/wrangler/e2e/dev-registry.test.ts +++ b/packages/wrangler/e2e/dev-registry.test.ts @@ -105,6 +105,8 @@ describe("unstable_dev()", () => { } ); + await setTimeout(2000) + const parentWorker = await unstable_dev( "src/index.ts", { diff --git a/packages/wrangler/src/__tests__/dev.test.ts b/packages/wrangler/src/__tests__/dev.test.ts index 211c1176e8cf..4c6560f72394 100644 --- a/packages/wrangler/src/__tests__/dev.test.ts +++ b/packages/wrangler/src/__tests__/dev.test.ts @@ -1419,7 +1419,7 @@ describe.sequential("wrangler dev", () => { --test-scheduled Test scheduled events by visiting /__scheduled in browser [boolean] [default: false] --log-level Specify logging level [choices: \\"debug\\", \\"info\\", \\"log\\", \\"warn\\", \\"error\\", \\"none\\"] [default: \\"log\\"] --show-interactive-dev-session Show interactive dev session (defaults to true if the terminal supports interactivity) [boolean] - --experimental-registry, --x-registry Use the experimental file based dev registry for multi-worker development [boolean] [default: false] + --experimental-registry, --x-registry Use the experimental file based dev registry for multi-worker development [boolean] [default: true] --experimental-vectorize-bind-to-prod Bind to production Vectorize indexes in local development mode [boolean] [default: false]", "warn": "", } diff --git a/packages/wrangler/src/api/dev.ts b/packages/wrangler/src/api/dev.ts index f6407f2198d7..2c4da2b5f4ba 100644 --- a/packages/wrangler/src/api/dev.ts +++ b/packages/wrangler/src/api/dev.ts @@ -125,7 +125,7 @@ export async function unstable_dev( showInteractiveDevSession, testMode, testScheduled, - fileBasedRegistry = false, + fileBasedRegistry = true, vectorizeBindToProd, // 2. options for alpha/beta products/libs d1Databases, diff --git a/packages/wrangler/src/api/integrations/platform/index.ts b/packages/wrangler/src/api/integrations/platform/index.ts index 3398efdd99e9..e058dcd5dbbf 100644 --- a/packages/wrangler/src/api/integrations/platform/index.ts +++ b/packages/wrangler/src/api/integrations/platform/index.ts @@ -110,7 +110,7 @@ export async function getPlatformProxy< const miniflareOptions = await run( { - FILE_BASED_REGISTRY: Boolean(options.experimentalRegistry), + FILE_BASED_REGISTRY: Boolean(options.experimentalRegistry ?? true), JSON_CONFIG_FILE: Boolean(options.experimentalJsonConfig), }, () => getMiniflareOptionsFromConfig(rawConfig, env, options) diff --git a/packages/wrangler/src/dev-registry/file-registry.ts b/packages/wrangler/src/dev-registry/file-registry.ts index 9520dca7bfcb..99b6e7bfbef6 100644 --- a/packages/wrangler/src/dev-registry/file-registry.ts +++ b/packages/wrangler/src/dev-registry/file-registry.ts @@ -65,6 +65,8 @@ async function devRegistry( async function startWorkerRegistry( cb?: (registry: WorkerRegistry | undefined) => void ) { + await loadWorkerDefinitions(); + cb?.({ ...globalWorkers }); globalWatcher ??= watch(DEV_REGISTRY_PATH, { persistent: true, }).on("all", async () => { diff --git a/packages/wrangler/src/dev.ts b/packages/wrangler/src/dev.ts index fe916df5b4b2..aa516bd8e863 100644 --- a/packages/wrangler/src/dev.ts +++ b/packages/wrangler/src/dev.ts @@ -314,7 +314,7 @@ const command = defineCommand({ type: "boolean", describe: "Use the experimental file based dev registry for multi-worker development", - default: false, + default: true, }, "experimental-vectorize-bind-to-prod": { type: "boolean",