跳到正文
Skillpedia
网站与界面(前端)75k · #2903

js-file-size

它能做什么

这个技能检查 JavaScript 包的体积,并标出对性能来说过重的文件。它面向页面在手机上显得很慢的开发者。

适用场景

  • ✓某个 JavaScript 文件压缩后超过约 200 KB 的时候。
  • ✓页面在低端手机上加载时没有响应的时候。
  • ✓你的包分析显示有几个非常大的依赖项的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/js-file-size/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/js-file-size/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我检查 JavaScript 包是不是太大了吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查包的体积,标出压缩后超过约 200 KB 的文件。它会建议做代码拆分、tree-shaking,并检查较重的依赖项。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Optimize JavaScript bundle size

Excessive JavaScript increases parse and execution time, especially on low-end devices, leading to sluggish user experiences and high data costs.

Quick Reference

  • Keep individual JS bundles under 200KB (compressed)
  • Large bundles delay Time to Interactive (TTI) and First Input Delay (FID)
  • Use code-splitting and tree-shaking to reduce unused code

Check

Review the JavaScript bundle sizes and identify any files exceeding 200KB (Gzip/Brotli).

Fix

Implement code-splitting, tree-shaking, and dependency audits to reduce the size of the JavaScript bundles.

Explain

Explain how large JavaScript files impact the main thread and delay user interactivity (FID/TTI).

Code Review

Review the routes, assets, and loading behavior that affect Optimize JavaScript bundle size. Flag exact files, requests, or rendering steps that add unnecessary network, CPU, or layout cost, and describe the measurement method used to confirm the issue.


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

Rule page: https://frontendchecklist.io/rules/performance/js-file-size

常见问题

为什么包的体积很重要?

这个技能说,大的脚本解析和运行都需要更长时间,在低端设备上尤其明显。

多大算太大?

这个技能把每个包压缩后约 200 KB 作为参考标准。

什么是代码拆分?

就是把代码分成更小的块,让每个页面只加载它需要的部分。

详情

作者的原始描述

Use when auditing slow page loads, heavy assets, or rendering delays related to Optimize JavaScript bundle size. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2903
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能