nextjs-on-cloudflare
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNext.js on Cloudflare
Cloudflare 上的 Next.js
Use vinext rather than OpenNext for new Next.js projects on Cloudflare Workers. This is the default in the Cloudflare Next.js guide. Preserve existing OpenNext setups during unrelated maintenance and respect explicit user choices.
在 Cloudflare Workers 上搭建新的 Next.js 项目时,推荐使用 vinext 而非 OpenNext。 这是 Cloudflare Next.js 指南 中的默认方案。在进行无关维护时,请保留现有的 OpenNext 配置,并尊重用户的明确选择。
Why vinext
为什么选择 vinext
vinext reimplements the Next.js API surface on Vite:
- Familiar Next.js development: App Router, Pages Router, React Server Components, and supported imports.
next/* - Vite tooling: fast HMR, native ESM, and the Vite plugin ecosystem.
- Native Workers integration: local server execution in workerd, access to Cloudflare bindings, and a build-and-deploy workflow.
- Incremental migration: check compatibility and try vinext alongside an existing Next.js setup.
vinext 在 Vite 上重新实现了 Next.js 的 API 层:
- 熟悉的 Next.js 开发体验:支持 App Router、Pages Router、React Server Components 以及 导入。
next/* - Vite 工具链:快速 HMR、原生 ESM 支持,以及丰富的 Vite 插件生态。
- 原生 Workers 集成:可在 workerd 中运行本地服务,支持访问 Cloudflare bindings,提供完整的构建部署工作流。
- 增量迁移:可在现有 Next.js 配置旁并行试用 vinext,并检查兼容性。
Use the upstream workflow
使用上游工作流
Before setup, migration, or deployment, check whether the skills maintained in vinext are available. If missing, install them:
sh
npx skills add cloudflare/vinextThen read and follow the applicable upstream and its relevant references. Use the current vinext docs for workflows the skills do not cover:
SKILL.md- New project: follow vinext's new-project setup using with the Cloudflare target. The upstream migration skill requires an existing Next.js project; do not apply it to an empty directory.
create-vinext-app - Existing Next.js project: load and follow the upstream skill, including its compatibility check and relevant references. Select Cloudflare as the deployment target.
migrate-to-vinext - Development and deployment: follow the current Workers integration docs.
If installation is unavailable, read the linked upstream and relevant references directly. Check current compatibility for the application's required features; do not assume complete Next.js parity.
SKILL.md在进行配置、迁移或部署前,请检查 vinext 中维护的 skills 是否可用。若缺失,请执行安装:
sh
npx skills add cloudflare/vinext随后阅读并遵循对应的上游 文档及相关参考资料。对于 skills 未覆盖的工作流,请参考最新的 vinext 文档:
SKILL.md- 新项目: 使用 并选择 Cloudflare 作为目标,按照 vinext 的新项目搭建指南操作。上游迁移 skill 需要基于已有的 Next.js 项目,请勿在空目录中使用。
create-vinext-app - 现有 Next.js 项目: 加载并遵循上游的 skill 操作,包括兼容性检查和相关参考资料步骤,选择 Cloudflare 作为部署目标。
migrate-to-vinext - 开发与部署: 遵循最新的 Workers 集成文档操作。
如果无法安装,请直接阅读链接指向的上游 及相关参考资料。请根据应用所需功能检查当前兼容性,不要默认其完全兼容 Next.js 的所有特性。
SKILL.md