Skip to content

Vite plugin support for experimental Build Output API#14279

Merged
jamesopstad merged 4 commits into
mainfrom
james/vite-build-output-api
Jun 15, 2026
Merged

Vite plugin support for experimental Build Output API#14279
jamesopstad merged 4 commits into
mainfrom
james/vite-build-output-api

Conversation

@jamesopstad

@jamesopstad jamesopstad commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Add experimental.newConfig.cfBuildOutput option to support future deployments via the cf CLI

// vite.config.ts
import { defineConfig } from "vite";
import { cloudflare } from "@cloudflare/vite-plugin";

export default defineConfig({
	plugins: [
		cloudflare({
			experimental: {
				newConfig: {
					cfBuildOutput: true,
				},
			},
		}),
	],
});

  • 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: experimental feature

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

@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c5771e0

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-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Posted the review on PR #14279.

Summary of the actionable finding:

  • High severitybuildModulesFromManifest (packages/vite-plugin-cloudflare/src/miniflare-options.ts:611) builds the Miniflare modules array in worker.config.json manifest order, which derives from the Rollup bundle map iteration order in writeBundle. workerd treats modules[0] as the entrypoint, but the entry chunk is not guaranteed to be first. The legacy getPreviewModules path explicitly puts the entry first; this new path does not, so vite preview can load the wrong module as the entrypoint. I posted a suggestion that sorts mainModule to the front.

github run

@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown
create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: c5771e0

@jamesopstad jamesopstad force-pushed the james/vite-build-output-api branch 5 times, most recently from 504e869 to 17d4c1e Compare June 15, 2026 11:08
Comment thread packages/config/src/types.ts
@jamesopstad jamesopstad force-pushed the james/vite-build-output-api branch from 1681746 to 364f8a1 Compare June 15, 2026 12:05
@jamesopstad jamesopstad changed the title WIP - Vite support for experimental Build Output API Vite support for experimental Build Output API Jun 15, 2026
@jamesopstad jamesopstad changed the title Vite support for experimental Build Output API Vite plugin support for experimental Build Output API Jun 15, 2026
@jamesopstad jamesopstad marked this pull request as ready for review June 15, 2026 12:16
@workers-devprod workers-devprod requested review from a team and dario-piotrowicz and removed request for a team June 15, 2026 12:16
@workers-devprod

workers-devprod commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@jamesopstad jamesopstad requested review from emily-shen and penalosa and removed request for dario-piotrowicz June 15, 2026 12:18

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

Open in Devin Review

Comment thread packages/vite-plugin-cloudflare/src/plugins/build-output.ts
Comment thread packages/config/src/schema.ts
Comment thread packages/vite-plugin-cloudflare/src/build-output.ts
devin-ai-integration[bot]

This comment was marked as resolved.

@emily-shen emily-shen 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.

Approving as this makes sense from my end - build output is what cf is expecting. I'm afraid i'm a bit lost on some of the vite-plugin stuff though.

@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 15, 2026
@jamesopstad jamesopstad force-pushed the james/vite-build-output-api branch from 98ad087 to c5771e0 Compare June 15, 2026 17:05
@jamesopstad jamesopstad merged commit e6e4b07 into main Jun 15, 2026
63 of 64 checks passed
@jamesopstad jamesopstad deleted the james/vite-build-output-api branch June 15, 2026 18:21
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Jun 15, 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.

3 participants