本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)75k · #2774

code-splitting

できること

このスキルは、時々しか必要ないのに、重いスクリプトがすべてのページで読み込まれていないかを確認します。最初の読み込みを速くしたい、シングルページアプリの開発者向けです。

使う場面

  • ✓Webアプリのバンドルが大きく、起動に時間がかかるとき。
  • ✓使われないページで、グラフ、エディター、その他の重いライブラリが読み込まれているとき。
  • ✓後から読み込めばよい新しい依存関係を追加するとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/code-splitting/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/code-splitting/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“私のアプリは、すべてのページで大きなグラフのライブラリを読み込んでいます。グラフが表示される場所でだけ読み込まれるように分けてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、重い静的なimportを動的なimportの呼び出しに変え、ルートごとにコードを分け、コードが届くまでページを使えるように読み込み中の表示を追加します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Split large JavaScript bundles

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.

Quick Reference

  • Use dynamic import() to load code only when it's actually needed
  • Split routes in SPAs so each page loads only its own code
  • Lazy-load heavy third-party libraries (chart libraries, rich text editors)
  • Analyze your bundle with a visualizer to find what to split

Check

Identify any large third-party imports or feature modules in this file that could be loaded lazily with dynamic import() instead of statically.

Fix

Convert the identified static imports to dynamic imports using import() and add appropriate loading states.

Explain

Explain JavaScript code splitting, how dynamic import() works, and how to implement route-based splitting in a SPA.

Code Review

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/rules/javascript/code-splitting

よくある質問

動的なimportは何をしますか?

起動時ではなく、本当に必要になったときにだけコードを読み込むと、このスキルは説明しています。

最初に分けるべきものは何ですか?

ルートごとの部分と、グラフのライブラリやリッチテキストエディターなどの重いサードパーティのライブラリです。

何を分けるべきかは、どう分かりますか?

可視化ツールでバンドルを分析することを、このスキルは提案しています。

詳細

作者による元の説明

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 can move behind route transitions, user interaction, or viewport-based loading.

repo: thedaviddias/Front-End-Checklist

人気

GitHubのスター
75k
ランキング
#2774
ライセンス
MIT
更新日
2026/10/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル