Skip to content

[autoconfig] Set up Hono projects for cf with Vite - #17246

Merged
edmundhung merged 10 commits into
autoconfig-setup-after-migrationfrom
autoconfig-hono-cf
Nov 30, 2026
Merged

edmundhung merged 10 commits into
autoconfig-setup-after-migrationfrom
autoconfig-hono-cf

Conversation

@edmundhung

@edmundhung edmundhung commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Part of RM-31810. Stacked on #17238.

On cf, autoconfig now sets up Hono projects instead of refusing them, building them with Vite and the Cloudflare plugin like Hono's Workers + Vite starter. It adds Vite to a plain Hono app, replaces Hono's own Vite dev server and build plugins, and uses the app's entry file (the Wrangler main, the entry given to Hono's Vite plugins, or src/index.ts(x)) as the Worker entry point. An entry file that doesn't export the app, such as Hono's Node.js starter, is refused, and so is HonoX for now. The Wrangler target is unchanged.

Along the way, cf stops treating @netlify/build-info's generic <package manager> run build as a framework's own build command, and the shared parser accepts JSX in .tsx files.


  • 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: the Cloudflare docs don't cover autoconfig's API

@changeset-bot

changeset-bot Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6e14cd5

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/autoconfig 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

ask-bonk[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

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

PR #17246 adds cf autoconfiguration support for Hono projects.

  1. P1 Hono accepts Wrangler configs without a Worker entrypoint, producing an assets-only cloudflare.config.ts. Posted one inline suggestion.

github run

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new

pkg-pr-new Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@17246

@cloudflare/cli-shared-helpers

npm i https://pkg.pr.new/@cloudflare/cli-shared-helpers@17246

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@17246

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@17246

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@17246

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@17246

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@17246

@cloudflare/test-server

npm i https://pkg.pr.new/@cloudflare/test-server@17246

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@17246

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 6e14cd5

devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung edmundhung changed the title [autoconfig] Set up Hono projects for cf [autoconfig] Set up Hono projects for cf with Vite Nov 27, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung
edmundhung marked this pull request as ready for review November 28, 2026 00:35
@workers-devprod
workers-devprod requested review from a team and jamesopstad and removed request for a team November 28, 2026 00:35
@workers-devprod

workers-devprod commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

clanky-the-clanker[bot]

This comment was marked as resolved.

@clanky-the-clanker clanky-the-clanker 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.

Superseded by the review of c57cc6c3.

This review, of 14de0f72

💬 Approved with comments — No blocking or warning-level issues. One INFO note remains open about a leftover Hono dev-server adapter import, which the author has deferred.

Findings: 1 info

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

One INFO note remains open about a leftover adapter import. Nothing new blocks.

Recommendation: 💬 Optional Nits

  • [INFO] The @hono/vite-dev-server/cloudflare adapter import can be left behind, unused, after devServer(...) is replaced. The author deferred this. (packages/autoconfig/src/frameworks/hono.ts:139)
View full review

Leftover adapter import. readHonoVitePlugins only collects default imports whose source is exactly @hono/vite-dev-server or @hono/vite-build. Some configs also have import adapter from "@hono/vite-dev-server/cloudflare" and pass it to devServer({ adapter }). In those configs, the adapter import stays in the file, unused, after devServer(...) is removed. The author has deferred this, since dropping an import safely means checking its other uses, so it is kept as INFO.

The new supported: boolean type, JSX parsing for .jsx and .tsx, and the dropped generic <pm> run build command are consistent with every caller.


✅ All other checks passed

🚀 Release: ✅ LGTM

The changeset records the new Hono setup as a minor feature and says which projects it supports. The setup installs Vite and the Cloudflare plugin and rewrites the project's Vite configuration. These changes happen in the user's own project, where they can be reviewed and undone.


🔒 Security: ✅ LGTM

No security issues found.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md issues found.


⚡ Performance: ✅ LGTM

No performance issues found.


📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: 14de0f72

edmundhung added a commit to cloudflare/cf that referenced this pull request Nov 28, 2026

@jamesopstad jamesopstad 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 with a couple of comments.

@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

@clanky-the-clanker clanky-the-clanker 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.

Superseded by the review of 6e14cd55.

This review, of c57cc6c3

✅ Approved — The two follow-up changes, leaving Vite's install to setup and passing target for CommonJS packages, are correct and have tests, and nothing new came up. The one earlier note still open, a leftover adapter import, was deferred by the author.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset follows the repository's convention of a minor version for new features. The setup only changes files in the user's own project, where those changes can be reviewed and undone.


🔒 Security: ✅ LGTM

The Vite config and entry files are only parsed statically. They are never run, and nothing is written outside the user's project.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md issues found.


📋 Code Quality: ✅ LGTM

Hono no longer installs Vite itself; setup's own install now handles it. It also passes target to transformViteConfig, and a test covers a package with no "type". I found no new issues.

One earlier note is still open and not repeated here: the leftover @hono/vite-dev-server/cloudflare adapter import, which you have deferred.


⚡ Performance: ✅ LGTM

This is one-off setup code with single parses; nothing in it runs on a hot path.


📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: c57cc6c3

devin-ai-integration[bot]

This comment was marked as resolved.

@clanky-the-clanker clanky-the-clanker 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.

✅ Approved — The supported flag change since the last review is handled correctly by every caller, and nothing new came up. The one earlier note still open was deferred by the author.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

The changeset records a minor release for the new Hono setup, which matches how the repository releases new features. The setup only changes files in the user's own project, where those changes can be reviewed and undone.


🔒 Security: ✅ LGTM

Setup only parses the Vite config and entry files statically. It never runs them, and it writes nothing outside the user's project.


📖 AGENTS.md: ✅ LGTM

No AGENTS.md issues found.


📋 Code Quality: ✅ LGTM

FrameworkInfo.supported is now a boolean, and Hono sets it to target === "cf". Every place that reads it handles a value only known at runtime:

  • frameworks/index.ts checks supported === false and picks NoOpFramework for Hono on Wrangler.
  • isFrameworkSupported returns the flag as is.
  • supported !== true and supported === true in frameworks/index.ts and details/index.ts work as expected.

One earlier note is still open: the leftover @hono/vite-dev-server/cloudflare adapter import, which you deferred.


⚡ Performance: ✅ LGTM

This is one-off setup code; nothing in it runs on a hot path.


📝 Documentation: ✅ LGTM

No documentation issues found.


Reviewed commit: 6e14cd55

@edmundhung
edmundhung merged commit d28fede into main Nov 30, 2026
84 checks passed
@edmundhung
edmundhung deleted the autoconfig-hono-cf branch November 30, 2026 15:08
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Nov 30, 2026
edmundhung added a commit to cloudflare/cf that referenced this pull request Nov 30, 2026
edmundhung added a commit to cloudflare/cf that referenced this pull request Nov 30, 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