Skip to content

[wrangler] fix: respect find_additional_modules when no_bundle is set#14315

Merged
petebacondarwin merged 5 commits into
cloudflare:mainfrom
matingathani:fix/no-bundle-find-additional-modules
Jun 17, 2026
Merged

[wrangler] fix: respect find_additional_modules when no_bundle is set#14315
petebacondarwin merged 5 commits into
cloudflare:mainfrom
matingathani:fix/no-bundle-find-additional-modules

Conversation

@matingathani

@matingathani matingathani commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #10063.

When no_bundle = true is configured, wrangler was always collecting and attaching additional modules even if find_additional_modules was explicitly set to false. The setting was being ignored in the no-bundle path.

The fix adds a findAdditionalModulesEnabled parameter to noBundleWorker (defaults to false) and updates all four call sites — deploy.ts, versions/upload.ts, BundlerController.ts, and preview.ts — to pass the config value through. When find_additional_modules is not set, the default is false, which is consistent with how the bundled code path already behaves (see the comment "moduleCollector doesn't get used when noBundle is set, so findAdditionalModules always defaults to false").

I noticed the comment in deploy.ts and upload.ts already says "findAdditionalModules always defaults to false" for the module collector, but the actual noBundleWorker call was not respecting that — it was scanning regardless.


  • Tests
    • Additional testing not necessary because: the change is a one-line conditional that skips findAdditionalModules when the config says to. The existing unit tests for noBundleWorker cover the happy path. The behaviour when the flag is false is identical to returning [], which is what bundleWorker also does when findAdditionalModules is false.
  • Public documentation
    • Documentation not necessary because: this is a bug fix — the config option find_additional_modules already documents that setting it to false should skip additional module discovery.

Open in Devin Review

Copilot AI review requested due to automatic review settings June 16, 2026 05:00
@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d89372

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

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

@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team June 16, 2026 05:01
@workers-devprod

workers-devprod commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ Incomplete fix: runBuild in use-esbuild.ts ignores findAdditionalModules when noBundle is true (packages/wrangler/src/dev/use-esbuild.ts:115-127)

The PR fixes noBundleWorker and its call sites in deploy.ts, versions/upload.ts, preview.ts, and BundlerController.ts#runCustomBuild, but misses the parallel code path in use-esbuild.ts. The getAdditionalModules() function at packages/wrangler/src/dev/use-esbuild.ts:115-126 always calls doFindAdditionalModules when noBundle is true, ignoring the findAdditionalModules parameter that was already passed into runBuild (line 55/83). This path is reached during wrangler dev without a custom build command, via BundlerController.ts:248 which passes findAdditionalModules: config.build?.findAdditionalModules (line 266). As a result, setting find_additional_modules = false with no_bundle = true will still scan for and attach additional modules during wrangler dev.

Open in Devin Review

When no_bundle was true, wrangler always collected additional modules
even if find_additional_modules was explicitly set to false. Pass the
flag through to noBundleWorker so the config setting is honoured, and
add tests covering both the default (collect) and opt-out (skip) cases.
@matingathani matingathani force-pushed the fix/no-bundle-find-additional-modules branch from 137b2ad to afcd119 Compare June 16, 2026 05:22
@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jun 16, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Jun 16, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14315

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14315

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14315

miniflare

npm i https://pkg.pr.new/miniflare@14315

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14315

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14315

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14315

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14315

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14315

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14315

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14315

wrangler

npm i https://pkg.pr.new/wrangler@14315

commit: 2d89372

The non-custom-build dev path in use-esbuild.ts was calling
doFindAdditionalModules unconditionally when noBundle was true,
ignoring the findAdditionalModules flag. Gate it behind
findAdditionalModules !== false to match the other call sites.
Comment thread packages/wrangler/src/deployment-bundle/maybe-build-worker.ts Outdated
Comment thread packages/wrangler/src/deployment-bundle/no-bundle-worker.ts
@petebacondarwin petebacondarwin removed the request for review from dario-piotrowicz June 16, 2026 08:28

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jun 16, 2026
@petebacondarwin petebacondarwin merged commit a79b899 into cloudflare:main Jun 17, 2026
55 checks passed
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

find_additional_modules seems to not be respected if no_bundle is set

4 participants