Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)75k · #2918

legacy-js

Skill này làm gì

Skill này kiểm tra xem website có gửi mã đã biên dịch cũ và polyfill thừa cho trình duyệt không cần chúng hay không. Skill dành cho lập trình viên quản lý cài đặt build.

Khi nào nên dùng

  • ✓Khi bundle của bạn có nhiều polyfill cho các tính năng mà trình duyệt hiện đại đã hỗ trợ.
  • ✓Khi công cụ build của bạn mặc định nhắm tới trình duyệt rất cũ.
  • ✓Khi bạn muốn mã nhỏ hơn, nhanh hơn cho các trình duyệt hiện tại.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/legacy-js/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể thiết lập build của tôi để trình duyệt hiện đại nhận JavaScript nhẹ hơn không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent xem lại các mục tiêu build và polyfill có trong đầu ra. Agent gợi ý phục vụ khác nhau theo trình duyệt, với script module và nomodule, cùng mục tiêu biên dịch hiện đại.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Avoid serving legacy JavaScript to modern browsers

Modern browsers can execute ES6+ code faster and more efficiently; serving them transpiled ES5 with polyfills adds unnecessary weight.

Quick Reference

  • Use differential serving (module/nomodule) to target modern and legacy browsers
  • Avoid heavy ES5 polyfills for browsers that support ES6+
  • Compile code to modern targets to reduce bundle size and improve execution speed

Check

Analyze the project's JavaScript output to see if modern browsers are being served unnecessary ES5 code and polyfills.

Fix

Update the build configuration to use differential serving and set a modern target for your primary JavaScript output.

Explain

Explain how serving ES6+ code to modern browsers improves performance and why transpiling everything to ES5 is no longer recommended.

Code Review

Review the routes, assets, and loading behavior that affect Avoid serving legacy JavaScript to modern browsers. 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/legacy-js

Câu hỏi thường gặp

Phục vụ khác nhau là gì?

Đó là gửi mã hiện đại cho trình duyệt hiện đại, còn mã cũ chỉ gửi cho trình duyệt cần nó.

Vì sao không dùng ES5 cho tất cả?

Skill nói trình duyệt hiện đại chạy mã ES6 trở lên nhanh hơn và hiệu quả hơn.

Mục tiêu được đặt ở đâu?

Skill chỉ đến cấu hình build, nơi chọn mục tiêu đầu ra.

Chi tiết

Mô tả gốc của tác giả

Use when auditing slow page loads, heavy assets, or rendering delays related to Avoid serving legacy JavaScript to modern browsers. Verify the actual bottleneck in DevTools, Lighthouse, or field data before recommending changes.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2918
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự