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

import-on-interaction

できること

このスキルは、誰も使う前から読み込まれている重い機能を、ページのコードで確認します。初回の読み込みを速くしたい開発者向けです。

使う場面

  • ✓チャットウィジェットや地図が、ほとんど使われないのに毎回の訪問で読み込まれているとき。
  • ✓誰も開いていないエディターや書き出しのツールが、最初の読み込みに含まれているとき。
  • ✓初期のコードのバンドルが、最初の表示に必要なサイズよりずっと大きいとき。

スキルのリンク

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/import-on-interaction/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“チャットウィジェットを、訪問者がクリックして開いたときだけ読み込むようにしてもらえますか。”

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

仕組み

エージェントは、クリック、フォーカス、ホバーの後でしか必要ない機能を見つけ、動的な import で読み込むことを提案します。読み込み中も、すぐにフィードバックを表示することを提案します。

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

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

Load non-critical code on user interaction

Users should not pay the download, parse, and execution cost for features they may never use. Import-on-interaction shrinks initial JavaScript, reduces main-thread work during page load, and keeps the first view focused on content that matters immediately.

Quick Reference

  • Move non-essential code behind clicks, focus, hovers, or explicit user actions
  • Use dynamic import() so the code is absent from the initial route bundle
  • Show immediate UI feedback while the deferred chunk loads
  • Use this for chat widgets, editors, maps, filters, and export flows that are not needed on first paint

Check

Inspect this route or component for heavy modules, widgets, or third-party scripts that load on first render but are only needed after a user clicks, focuses, hovers, or opens a panel.

Fix

Move the non-critical dependency behind a user-triggered dynamic import(), add immediate loading feedback, and ensure the initial render still works without the deferred feature.

Explain

Explain import-on-interaction, why it improves initial performance, and which features are safe to defer until the user shows intent.

Code Review

Inspect event handlers, modal triggers, drawers, editors, maps, export actions, and third-party widgets. Flag code that is included in the initial bundle even though it is only needed after a user interaction, and verify the fix keeps the initial path lighter without degrading the triggered flow.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/performance/import-on-interaction

よくある質問

動的な import とは何ですか?

最初のページの読み込みではなく、必要になったときだけコードを読み込む仕組みです。

どの機能を遅らせても安全ですか?

チャットウィジェット、エディター、地図、フィルター、書き出しの流れなど、最初の表示に必要ないものを挙げています。

その機能がなくてもページは動きますか?

はい。最初の描画は、遅延された機能がなくても動くべきだとこのスキルは説明しています。

詳細

作者による元の説明

Use when reviewing slow initial loads caused by optional features. Prioritize code that is expensive to download or execute and not required for the first viewport, first input, or core task completion.

repo: thedaviddias/Front-End-Checklist

人気

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

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

0

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

コメント

  • …

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

似ているスキル