Communitygithub.com

JantonioFC/skillsbank

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 对比 webpack。

skillsbank 是什么?

该技能文档详细介绍了 Next.js 16 及以上版本中 Turbopack 的使用方法和最佳实践。Turbopack 是一个用 Rust 编写的增量打包器,作为 Next.js 的默认开发服务器,可以显著加快本地开发的冷启动和热模块替换(HMR),尤其适用于大型项目。文档对比了 Turbopack 与传统 webpack 的适用场景:日常开发优先使用 Turbopack,仅在遇到 bug 或依赖特定 webpack 插件时回退,并提供了通过命令行参数切换的方法。此外,还涵盖了文件系统缓存机制(默认启用,无需额外配置)以及 Next.js 16.1+ 的实验性 Bundle Analyzer 工具,用于分析输出文件并优化生产构建。整体而言,本技能帮助开发者最大化利用 Turbopack 带来的性能提升,同时为过渡期提供兼容性指导。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/skills/ck

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Next.js 和 Turbopack

Next.js 16+ 默认使用 Turbopack 进行本地开发:一个用 Rust 编写的增量打包器,能显著提升开发启动速度和热更新性能。

何时使用

  • Turbopack(默认开发环境):用于日常开发。在大型应用中,能实现更快的冷启动和 HMR。
  • Webpack(遗留开发环境):仅在遇到 Turbopack 的 bug 或开发中依赖 webpack 专用插件时使用。通过 --webpack(或 --no-turbopack,具体取决于您的 Next.js 版本;请查阅对应版本的文档)禁用。
  • 生产环境:next build 的生产构建行为可能根据 Next.js 版本使用 Turbopack 或 webpack;请查阅您对应版本的官方 Next.js 文档。

适用于:开发或调试 Next.js 16+ 应用、诊断开发启动缓慢或 HMR 问题、优化生产构建包。

工作原理

  • Turbopack:Next.js 开发的增量打包器。使用文件系统缓存,重启速度显著提升(大型项目可达 5–14 倍)。
  • 开发环境默认:从 Next.js 16 开始,next dev 默认使用 Turbopack,除非禁用。
  • 文件系统缓存:重启时复用之前的工作;缓存通常位于 .next 目录下;基本使用无需额外配置。
  • Bundle Analyzer(Next.js 16.1+):实验性的 Bundle Analyzer,用于检查输出并发现大型依赖;通过配置或实验性标志启用(请查阅您对应版本的 Next.js 文档)。

示例

命令

next dev
next build
next start

使用

运行 next dev 进行本地开发,使用 Turbopack。使用 Bundle Analyzer(参见 Next.js 文档)优化代码拆分并精简大型依赖。尽可能优先使用 App Router 和服务端组件。

最佳实践

  • 保持使用最新的 Next.js 16.x 版本,以获得稳定的 Turbopack 和缓存行为。
  • 如果开发缓慢,请确保您正在使用 Turbopack(默认)且缓存未被不必要地清除。
  • 对于生产构建包体积问题,请使用适用于您版本的官方 Next.js 构建包分析工具。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

JantonioFC/skillsbank

AI-powered image editing with style transfer and object removal

JantonioFC/skillsbank

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

JantonioFC/skillsbank

Analise e auditoria de editais de leilao judicial e extrajudicial. Riscos ocultos, clausulas perigosas, debitos, ocupante e classificacao da oportunidade.

JantonioFC/skillsbank

Embed Photopea in web apps using photopea.js. Covers embedding, file I/O, scripting, exporting, layers, text, filters, and the full Photoshop-compatible API.

JantonioFC/skillsbank

Best practices for Remotion - Video creation in React

JantonioFC/skillsbank

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

JantonioFC/skillsbank

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

JantonioFC/skillsbank

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

JantonioFC/skillsbank

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

JantonioFC/skillsbank

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

JantonioFC/skillsbank

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

JantonioFC/skillsbank

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

JantonioFC/skillsbank

Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results, agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

JantonioFC/skillsbank

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

JantonioFC/skillsbank

When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,'...

JantonioFC/skillsbank

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, expla...

JantonioFC/skillsbank

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awarene...

JantonioFC/skillsbank

Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, fole...

JantonioFC/skillsbank

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

JantonioFC/skillsbank

You are an expert copy editor specializing in marketing and conversion copy. Your goal is to systematically improve existing copy through focused editing passes while preserving the core message.

相关技能