मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग75k · #2836

es-modules

यह क्या करती है

यह स्किल पुराने module सिंटैक्स वाली JavaScript फ़ाइलों की समीक्षा करती है और आधुनिक मानक सुझाती है। यह उन डेवलपर्स के लिए है जो हल्का और साफ़ कोड चाहते हैं।

कब इस्तेमाल करें

  • ✓जब आपकी JavaScript फ़ाइलें अब भी require() या module.exports इस्तेमाल करती हैं।
  • ✓जब आपके bundle में ऐसा कोड है जो आप कभी इस्तेमाल नहीं करते।
  • ✓जब आप चाहते हैं कि आपकी स्क्रिप्ट्स नेटिव browser modules के रूप में लोड हों।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/es-modules/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप मेरी JavaScript फ़ाइल के require statements को import सिंटैक्स में बदल सकते हैं?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट require और module.exports वाली लाइनें खोजता है और मेल खाते import और export statements सुझाता है। जहाँ उपयुक्त हो, वहाँ named exports की सिफ़ारिश भी करता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Use ES modules (import/export)

ES modules are statically analyzable — bundlers can determine at build time what code is actually used and eliminate the rest (tree-shaking). CommonJS require() is dynamic and prevents this optimization. ES modules are also the browser-native standard, reducing the need for build-time transformation.

Quick Reference

  • Use import/export syntax instead of require()/module.exports
  • Named exports improve IDE autocompletion and enable tree-shaking
  • Add type="module" to script tags or use a bundler to load ES modules in browsers
  • Default exports are fine but named exports scale better in large codebases

Check

Identify any use of require(), module.exports, or exports in this JavaScript file that should be converted to ES module syntax.

Fix

Convert all require() and module.exports statements to ES module import/export syntax.

Explain

Explain the benefits of ES modules over CommonJS, including tree-shaking, static analysis, and browser support.

Code Review

Review scripts, client components, and browser execution paths related to Use ES modules (import/export). Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.


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

Rule page: https://frontendchecklist.io/rules/javascript/es-modules

अक्सर पूछे जाने वाले सवाल

tree-shaking क्या है?

यह तब होता है जब bundler ऐसा कोड हटा देता है जो कभी इस्तेमाल नहीं होता, जिससे फ़ाइलें छोटी होती हैं। आधुनिक module सिंटैक्स इसे संभव बनाता है।

क्या मुझे named exports इस्तेमाल करने चाहिए?

स्किल कहती है कि बड़े codebases में named exports बेहतर बढ़ते हैं, हालाँकि default exports भी ठीक हैं।

browser में modules कैसे लोड करें?

स्किल script टैग में type=module जोड़ने, या bundler इस्तेमाल करने का सुझाव देती है।

जानकारी

लेखक का मूल विवरण

Use when reviewing scripts, client components, bundles, or runtime behavior related to Use ES modules (import/export). Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

repo: thedaviddias/Front-End-Checklist

लोकप्रियता

GitHub स्टार
75k
रैंकिंग में स्थान
#2836
लाइसेंस
MIT
अपडेट की गई
31/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills