Skip to content

Revert "Revert "Add support for applications that use the entry Worker during development but not at build time""#13813

Closed
penalosa wants to merge 1 commit into
mainfrom
revert-13811-revert-12788-james/inferred-assets-only
Closed

Revert "Revert "Add support for applications that use the entry Worker during development but not at build time""#13813
penalosa wants to merge 1 commit into
mainfrom
revert-13811-revert-12788-james/inferred-assets-only

Conversation

@penalosa
Copy link
Copy Markdown
Contributor

@penalosa penalosa commented May 5, 2026

Reverts #13811


Open in Devin Review

@penalosa penalosa requested a review from workers-devprod as a code owner May 5, 2026 13:49
@penalosa penalosa added the run-c3-frameworks-tests Run all the C3 frameworks tests on this PR label May 5, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

🦋 Changeset detected

Latest commit: 01a9819

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk May 5, 2026
@workers-devprod workers-devprod requested review from a team and emily-shen and removed request for a team May 5, 2026 13:50
@workers-devprod
Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/rare-ducks-occur.md: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/test-utils/index.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/test-utils/vite-version.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/multi-worker/tests/custom-build-app/multi-worker.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/tests/base-tests.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/tests/no-ssr/prerendering.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/tests/prerendering.spec.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/index.html: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/package.json: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/vite.config.no-ssr.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/playground/prerendering/vite.config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/deploy-config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/plugins/config.ts: [@cloudflare/wrangler]
  • packages/vite-plugin-cloudflare/src/plugins/output-config.ts: [@cloudflare/wrangler]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

✅ All changesets look good

The changeset follows all the guidelines:

  • Version type: minor is appropriate for this new feature
  • Changelog quality: Clear description with context (Astro framework use case) and explanation of the change
  • No markdown headers: The content doesn't use h1/h2/h3 headers
  • Not a dependabot change: This is a feature addition, not a dependency update
  • Not an experimental feature: No opt-in note required

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 5, 2026

That's fine — defineConfig is well-known to be essentially an identity function for type checking. When the version check returns false and baseConfig = {}, spreading it in vite.config.no-ssr.ts will just give { builder: { buildApp(...) } } — a valid Vite config with no cloudflare plugin. The buildApp will build only the client, and since there's no cloudflare plugin, there's no buildApp: { order: "post" } hook. This seems fine for the Vite 6 case.

One observation though — in vite.config.no-ssr.ts, when Vite >= 7.0.0, baseConfig will have the cloudflare plugin and the prerender plugin. The no-ssr config overrides builder.buildApp to only build the client. But the cloudflare plugin's buildApp: { order: "post" } handler still runs. Since the entry worker environment (ssr) won't be built, entryWorkerEnvironment.isBuilt will be false, triggering the new isAssetsOnly = true fallback path. This is exactly the scenario the PR is adding support for.

I believe the code is correct. Let me verify one more edge case — in the test file, no-ssr/prerendering.spec.ts imports ../base-tests which runs the shared tests. The shared tests include a test for the /hello route that only runs in dev (!isBuild), and a test for /prerendered that only runs in build. The no-ssr spec additionally tests that /hello returns 404 in the build (since the SSR worker was not built). This coverage looks appropriate.

LGTM

github run

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

create-cloudflare

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 01a9819

Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

@jamesopstad
Copy link
Copy Markdown
Contributor

Closing this as I'll open a new PR that resolves the issues.

@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-c3-frameworks-tests Run all the C3 frameworks tests on this PR

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants