Use when reviewing large SPA bundles, new dependency additions, or routes that feel slow to hydrate. Focus on code that is not required for the initial view and
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-code-splitting-e6a70436d1a9 ,按照其中的说明把「code-splitting」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
A 500 KB JavaScript bundle blocks page interactivity for 3–5 seconds on a mid-range mobile device even after the bytes arrive — JS must be parsed and compiled before execution. Code splitting means users only download and parse the code they actually need for the current page, dramatically improving Time to Interactive.
Identify any large third-party imports or feature modules in this file that could be loaded lazily with dynamic import() instead of statically.
Convert the identified static imports to dynamic imports using import() and add appropriate loading states.
Explain JavaScript code splitting, how dynamic import() works, and how to implement route-based splitting in a SPA.
Inspect route modules, heavy feature imports, and third-party libraries loaded on initial render. Flag dependencies that can move behind import(), route boundaries, or user-triggered flows without breaking the first meaningful paint.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/en/rules/javascript/code-splitting