본문으로 건너뛰기
Skillpedia
일반 코딩75k · #2836

es-modules

하는 일

이 스킬은 오래된 모듈 문법을 쓰는 JavaScript 파일을 검토하고 최신 표준을 제안합니다. 더 가볍고 명확한 코드를 원하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓JavaScript 파일이 아직 require()나 module.exports를 쓸 때.
  • ✓번들에 내가 쓰지 않는 코드가 들어 있을 때.
  • ✓스크립트를 브라우저의 네이티브 모듈로 불러오고 싶을 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/es-modules/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“JavaScript 파일의 require 문을 import 문법으로 바꿔 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 require와 module.exports 줄을 찾아 맞는 import와 export 문으로 제안합니다. 알맞은 곳에서는 이름 있는 export도 권장합니다.

기술 내용 (원본 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

자주 묻는 질문

트리 셰이킹이란 무엇인가요?

번들러가 한 번도 쓰이지 않는 코드를 제거해 파일을 작게 만드는 것입니다. 최신 모듈 문법이 이를 가능하게 합니다.

이름 있는 export를 써야 하나요?

이 스킬은 큰 코드베이스에서는 이름 있는 export가 더 잘 확장된다고 말하지만, 기본 export도 여전히 괜찮다고 합니다.

브라우저에서 모듈을 어떻게 불러오나요?

스크립트 태그에 type=module을 추가하거나 번들러를 쓰라고 이 스킬은 제안합니다.

상세 정보

작성자의 원본 설명

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
업데이트
2026. 10. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬