fix(wrangler): derive nodejsCompatMode from the effective compatibility inputs in unstable_startWorker#14617
Draft
martijnwalraven wants to merge 1 commit into
Conversation
…ty inputs in startWorker The CLI feeds validateNodeCompatMode the effective values (args.* ?? parsedConfig.*); the programmatic path used input.build.nodejsCompatMode raw, so an unset mode ignored the worker's nodejs_compat flag whether it came from the config file or from input-level compatibilityFlags. Derive it the same way: input-level compatibilityDate/compatibilityFlags first, then the resolved config, with noBundle taken from the resolved build.bundle semantics. An explicit null still disables.
🦋 Changeset detectedLatest commit: c1a3527 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 |
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
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.
Makes
unstable_startWorker()honor a worker'snodejs_compatcompatibility flag, the waywrangler devdoes.The gap. The CLI derives the node-compat mode from the effective compatibility values — input overrides first, then the config file (
validateNodeCompatMode(args.compatibilityDate ?? parsedConfig.compatibility_date, args.compatibilityFlags ?? parsedConfig.compatibility_flags ?? [], { noBundle: args.noBundle ?? parsedConfig.no_bundle })instart-dev.ts). The programmatic path usedinput.build.nodejsCompatModeraw, so leaving it unset silently ignored the worker'snodejs_compatflag — whether it came from the worker's config file or from input-levelcompatibilityFlags— and bundling failed to resolvenode:*builtins thatwrangler devon the same configuration handles.The change. When the caller provides no
build.nodejsCompatMode,resolveConfigderives it from the same effective values the rest of the resolution uses:input.compatibilityDate ?? config.compatibility_date,input.compatibilityFlags ?? config.compatibility_flags ?? [], and no-bundle from the resolved bundle semantics (!(input.build?.bundle ?? !config.no_bundle)— the programmatic spelling of the CLI's--no-bundle). An explicit value — includingnullto disable — is still unwrapped exactly as before, so callers owning the mode keep it.Tests: derived
"v2"from a config file carryingcompatibility_date+nodejs_compat; derived"v2"from input-levelcompatibilityFlagsover a config file without the flag; explicitnullpreserved.nullpreserved)🤖 Generated with Claude Code