Skip to content

[vite-plugin] Support auxiliary Workers with new config#14654

Draft
ericclemmons wants to merge 2 commits into
mainfrom
codex/vite-auxiliary-workers-new-config
Draft

[vite-plugin] Support auxiliary Workers with new config#14654
ericclemmons wants to merge 2 commits into
mainfrom
codex/vite-auxiliary-workers-new-config

Conversation

@ericclemmons

@ericclemmons ericclemmons commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adds auxiliary Worker support when experimental.newConfig is enabled. Existing auxiliaryWorkers[].configPath entries now point to each auxiliary Worker's TypeScript config, while legacy Wrangler config behavior remains unchanged when the experiment is disabled.

The auxiliary configs use the same @cloudflare/config conversion path as the entry Worker, participate in config dependency watching, and retain parsed config data for Build Output API emission.

This is to maiintain parity with https://developers.cloudflare.com/workers/local-development/multi-workers/#single-dev-command. My preference is instead having something like this:

import * as api from "@repo/api" with { type: "cf-worker" }

...
env: {
  API: bindings.worker(api)
}

But that's just an incremental step to eventually having defineProject(...)!


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this extends an experimental API and includes a changeset plus an executable playground example.

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a2c8c54

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/vite-plugin Minor

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 10, 2026
@workers-devprod workers-devprod requested review from a team and ascorbic and removed request for a team July 10, 2026 23:13
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/quiet-pears-help.md: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/tests/worker.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/auxiliary/cloudflare.config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/auxiliary/index.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/cloudflare.config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/src/index.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/experimental-config/vite.config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/tests/experimental-new-config.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/plugin-config.ts: [@cloudflare/wrangler]

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

⚠️ Issues found

.changeset/quiet-pears-help.md

  • The changeset describes a feature behind experimental.newConfig but does not include an explicit note on how users can opt into the experimental feature. Please add a sentence explaining how to enable experimental.newConfig (e.g., where to set the flag / config option).

@ask-bonk ask-bonk 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.

I'm Bonk, and I've done a quick review of your PR.

Summary: enables auxiliaryWorkers[].configPath to point at a per-Worker cloudflare.config.ts when experimental.newConfig is on, routing auxiliary configs through the same @cloudflare/config conversion + watch + Build-Output path as the entry Worker.

One actionable issue (medium): relative string entrypoints in an auxiliary config are resolved against the project root instead of the auxiliary config's own directory. Everything else looks consistent with the legacy path.

Comment thread packages/vite-plugin-cloudflare/src/plugin-config.ts Outdated
@ask-bonk

ask-bonk Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review posted successfully to PR #14654.

I reviewed PR #14654 ([vite-plugin] Support auxiliary Workers with new config) and posted a batch review with one actionable finding:

Medium — relative string entrypoints in auxiliary configs resolve against the wrong base directory. The new-config auxiliary path forces configPath: undefined into resolveWorkerConfig, so maybeResolveMain falls back to root when resolving a relative main. The playground avoids this only because it uses the cf-worker import attribute (which @cloudflare/config converts to an absolute path). A plain-string entrypoint: "./index.ts" in a subdirectory auxiliary config passes through verbatim and would resolve to <root>/index.ts instead of the config-relative location. I posted a suggestion to anchor resolution to the auxiliary config's directory.

Everything else (validation guards, configPaths watch wiring, parsedNewConfig plumbing, generateTypes: false for aux, error display names, changeset) is consistent with the existing legacy path.

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14654

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: a2c8c54

@ericclemmons ericclemmons marked this pull request as draft July 10, 2026 23:16

@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 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread packages/vite-plugin-cloudflare/src/plugin-config.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants