[wrangler] Fix type-gen check for multi-worker setups#13273
Open
travisbreaks wants to merge 1 commit intocloudflare:mainfrom
Open
[wrangler] Fix type-gen check for multi-worker setups#13273travisbreaks wants to merge 1 commit intocloudflare:mainfrom
travisbreaks wants to merge 1 commit intocloudflare:mainfrom
Conversation
The `wrangler types --check` command ignored secondary worker configs passed via multiple `-c` flags. The staleness check ran before secondary entries were built, so `generateEnvTypes` always received an empty map. This produced a different hash than the original generation, causing the check to always report types as out of date. Move secondary entry resolution before the `--check` early return and thread the entries through to `checkTypesUpToDate`, which now forwards them to `generateEnvTypes` for accurate hash comparison. Fixes cloudflare#13196 Co-Authored-By: Tadao <tadao@travisfixes.com>
🦋 Changeset detectedLatest commit: e444dbb The changes in this PR will be included in the next version bump. 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 |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
penalosa
reviewed
Apr 13, 2026
Contributor
penalosa
left a comment
There was a problem hiding this comment.
This looks good, but could do with a unit test—would you be able to add one?
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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13196.
The
wrangler types --checkcommand was broken for multi-worker setups. When multiple config files were passed via-cflags, the--checkcode path returned early before building secondary worker entries. This meantgenerateEnvTypesalways received an emptysecondaryEntriesmap, producing a hash that never matched the originally generated types (which did include cross-worker information).The fix moves secondary entry resolution before the
--checkearly return and passes the entries through tocheckTypesUpToDate, which now forwards them togenerateEnvTypesfor accurate hash comparison.Changes
index.ts: Moved thesecondaryEntriesbuilding block before theargs.checkbranch so that secondary worker configs are resolved regardless of whether--checkis usedhelpers.ts: Added an optionalsecondaryEntriesparameter tocheckTypesUpToDate(defaults to an empty map for backward compatibility) and passes it togenerateEnvTypesinstead of a hardcoded empty map