feat(c3): scaffold Next.js apps with vinext instead of OpenNext - #14896
Conversation
Point create-cloudflare --framework=next at create-vinext-app so the generated project matches the recommended Next.js-on-Workers path (vinext dev/build + vinext-cloudflare deploy) instead of the OpenNext remote template.
🦋 Changeset detectedLatest commit: 7a2e2ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Prompt for vinext (default) vs OpenNext when scaffolding Next.js. --variant=vinext|opennext and -y/--accept-defaults (vinext) cover the non-interactive paths so OpenNext stays one flag away.
Update: OpenNext kept as an opt-in variantPer review feedback, C3 no longer drops OpenNext entirely.
Non-interactive: npm create cloudflare@latest my-app -- --framework=next --variant=vinext
npm create cloudflare@latest my-app -- --framework=next --variant=opennextE2E covers both ( |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
Curious if this should also be changed in autoconfig (people deploying existing Next apps)? I've been working on small improvements to Next autoconfig here #14892, but if vinext is the default path, could autconfig run cc @james-elicx keen to hear what you think 🙂 |
In theory it should work most of the time. In practice, you can never be 100% sure as there's always going to be the chance of a dependency or pattern that makes it incompatible. But, that doesn't necessarily mean we shouldn't do it, because those issues would likely also apply to OpenNext apps. |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
@scottbuscemi I think this is good as it is, we will need to come back to add docs on prewarming and workers cache once in place, but that's a little way off and this is still a better experience than what you're likely to get out of the box with the alternative. |
# Conflicts: # packages/create-cloudflare/src/frameworks/package.json
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
Head branch was pushed to by a user without write access
This reverts commit 549bba7.
Summary
Makes
create-cloudflare --framework=nextconfigure vinext, while keeping opennext available with a flag.Today C3's Next template only downloads the OpenNext remote template (
github:opennextjs/opennextjs-cloudflare/create-cloudflare/next). The docs PR at cloudflare/cloudflare-docs#31887 recommends vinext as the default. This PR makes C3 do the same, with OpenNext retained as an opt-in variant.Behavior
Interactive (
--framework=next) prompts:Non-interactive:
-y/--accept-defaultsselects vinext.Changes
templates/next/c3.ts(and experimental re-export):--variantforvinext|opennextcreate-vinext-appviarunFrameworkGeneratorwith--platform cloudflare --data-cache none --yes --skip-install --disable-git+ matching package-manager flagpreviewscript (build && start) so C3's sharedpreviewScript: "preview"works for both variantscreate-vinext-app@1.0.0-beta.1insrc/frameworks/package.json(keepcreate-next-apppin as well)next(vinext) +next:opennextin both stable and experimental matrices;getFrameworkConfigtolerates non-platform labels likenext:opennextGenerated project shapes
vinext (default)
{ "scripts": { "dev": "vinext dev", "build": "vinext build", "start": "wrangler dev --config dist/server/wrangler.json", "preview": "<pm> run build && <pm> run start --", "deploy": "vinext-cloudflare deploy --config dist/server/wrangler.json" } }opennext — same as today's template (
opennextjs-cloudflare build/deploy/preview, etc.)Notes / follow-ups for reviewers
--variant=opennextand the manual OpenNext adapter docs.--data-cache noneon the vinext path avoids a placeholder KV namespace id that would block deploy until the user provisions one.Note
This is a contribution from an AI agent: opencode, xai/grok-4.5. Opened as a draft for human review before any merge consideration.