Conversation
The middleware facade only wraps the default entrypoint and re-exports named entrypoints unchanged, so skipping it for named-only modules preserves existing behavior while avoiding an invalid default import. The regression test waits for the Worker runtime to reload and fails on build errors because worker.ready only indicates that the proxy server started and can resolve after a recoverable bundling failure.
🦋 Changeset detectedLatest commit: 226a196 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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
I'm Bonk, and I've done a quick review of your PR. Adds named-only module Worker support in local development.
|
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Move console-prefix from request middleware to an esbuild inject. The console-prefix module was previously loaded through the middleware facade only for its import-time side effect. Its default export was a passthrough that did not alter request handling. This is a noop refactor for default exports because injecting the module directly still applies the same patch. This is a fix for named-only workers, which were never able to load the middleware previously anyway.
|
packages/wrangler/src/deployment-bundle/apply-middleware.ts:R32-38 Export changes break watched rebuilds After a running Worker adds or removes its default export, Wrangler computes Example: Start Recommended fix: Derive facade eligibility from each build's current export metadata, or restart/reconfigure the bundle when the entrypoint's export shape changes. Add watch-mode tests for both default-to-named-only and named-only-to-default edits. |
|
|
||
| Allow `wrangler dev` to start module Workers without a default export | ||
|
|
||
| Wrangler now skips default-entrypoint middleware for Workers that only export named entrypoints. This avoids generating a middleware facade with an invalid default import. |
There was a problem hiding this comment.
Changeset exposes internal implementation
The second paragraph discusses the middleware facade and generated imports. REVIEW.md requires changesets to describe user-facing impact instead of internal implementation.
The middleware facade only wraps the default entrypoint and re-exports named entrypoints unchanged, so skipping it for named-only modules preserves existing behavior while avoiding an invalid default import.
The regression test waits for the Worker runtime to reload and fails on build errors because worker.ready only indicates that the proxy server started and can resolve after a recoverable bundling failure.
Followup to #15518
A picture of a cute animal (not mandatory, but encouraged)