nextjs-turbopack
它能做什么
这个工具帮你了解并使用 Turbopack,它是一项能加快 Next.js 网站开发速度的新技术。它会解释 Turbopack 的工作原理、适用场景,以及它如何提升你网站的速度。
适用场景
- ✓使用 Next.js 16 或更高版本开发网站时。
- ✓网站开发时,启动或更新都很慢的时候。
- ✓为项目在 Turbopack 和 Webpack 之间做选择时。
技能链接
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/nextjs-turbopack/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“如何让我的 Next.js 网站在开发时加载得更快?”
每周 5 个新技能,1 分钟读完。
工作原理
Turbopack 是一个用 Rust 编写的“打包”系统,负责组织你网站的代码。它使用文件系统缓存来记住之前的工作结果,因此更新速度大幅提升。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Next.js and Turbopack
Next.js 16+ uses Turbopack by default for local development: an incremental bundler written in Rust that significantly speeds up dev startup and hot updates.
When to Use
- Turbopack (default dev): Use for day-to-day development. Faster cold start and HMR, especially in large apps.
- Webpack (legacy dev): Use only if you hit a Turbopack bug or rely on a webpack-only plugin in dev. Disable with
--webpack(or--no-turbopackdepending on your Next.js version; check the docs for your release). - Production: Production build behavior (
next build) may use Turbopack or webpack depending on Next.js version; check the official Next.js docs for your version.
Use when: developing or debugging Next.js 16+ apps, diagnosing slow dev startup or HMR, or optimizing production bundles.
How It Works
- Turbopack: Incremental bundler for Next.js dev. Uses file-system caching so restarts are much faster (e.g. 5–14x on large projects).
- Default in dev: From Next.js 16,
next devruns with Turbopack unless disabled. - File-system caching: Restarts reuse previous work; cache is typically under
.next; no extra config needed for basic use. - Bundle Analyzer (Next.js 16.1+): Experimental Bundle Analyzer to inspect output and find heavy dependencies; enable via config or experimental flag (see Next.js docs for your version).
Examples
Commands
next dev
next build
next start
Usage
Run next dev for local development with Turbopack. Use the Bundle Analyzer (see Next.js docs) to optimize code-splitting and trim large dependencies. Prefer App Router and server components where possible.
Middleware File Naming
Next.js 16 introduced proxy.ts as the middleware filename, replacing the older middleware.ts convention:
- Next.js 16+: use
proxy.tsat the project root - Pre-Next.js 16: use
middleware.tsat the project root
The filename change is tied to the Next.js version, not to which bundler (Turbopack or webpack) is in use. Always check the official docs for the version you are reviewing.
Do not flag proxy.ts as a misnamed or missing middleware file in Next.js 16 projects. The file is correct and intentional. Suggesting a rename to middleware.ts will break middleware execution.
Reference: Next.js proxy docs
Best Practices
- Stay on a recent Next.js 16.x for stable Turbopack and caching behavior.
- If dev is slow, ensure you're on Turbopack (default) and that the cache isn't being cleared unnecessarily.
- For production bundle size issues, use the official Next.js bundle analysis tooling for your version.
常见问题
什么是 Turbopack?
它是一个组织 Next.js 网站代码的工具,能让网站运行得更快,在开发阶段尤其明显。
为什么我的 Next.js 开发速度很慢?
可能是你没有使用 Turbopack(它是最新的默认选项),或者它的缓存没有正常工作。请查看你所用版本的 Next.js 文档。
middleware 文件名有什么变化?
从 Next.js 16 开始,中间件文件从 `middleware.ts` 改名为 `proxy.ts`。这是有意的改动,并不是错误。
详情
作者的原始描述
Next.js 16+ and Turbopack guidance — incremental Rust bundling, file-system caching, faster dev startup and HMR, Turbopack vs webpack tradeoffs, and the middleware.ts to proxy.ts filename change. Use when developing or debugging Next.js 16+ apps, diagnosing slow dev startup or hot reload, choosing between bundlers, or reviewing middleware/proxy file naming.
repo: affaan-m/ECC
热度
- GitHub 星标
- 280k
- 排名
- #217
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
accessibility
280k帮你的智能体创建人人都能使用的界面。确保网站和应用对残障人士友好,比如失明或行动不便的用户也能顺畅使用。
agent-architecture-audit
280k让你的智能体检查一切是否正常运行。它能找出并修复 AI 系统中的问题,确保系统按预期工作。
agent-eval
280k帮你的智能体比较不同的 AI 编程工具。它能衡量哪个工具在特定任务上更快、更便宜、更可靠。
agent-harness-construction
280k让你的智能体更好地理解如何完成任务。它会优化智能体使用的工具和指令,提高成功的几率。