# Node 모듈은 전쟁중 : CommonJS vs ESM

> Clean Markdown view of GeekNews topic #2606. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=2606](https://news.hada.io/topic?id=2606)
- GeekNews Markdown: [https://news.hada.io/topic/2606.md](https://news.hada.io/topic/2606.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2020-08-07T10:34:45+09:00
- Updated: 2020-08-07T10:34:45+09:00
- Original source: [redfin.engineering](https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1)
- Points: 7
- Comments: 0

## Topic Body

CJS와 ESM은 구현체가 전혀 다름. 서로 호출은 가능하지만 귀찮음.

- CJS : require() 와 module.exports

- ESM : import 와 export

둘을 상세히 비교하고, 왜 다르고 연동이 귀찮은지 내부까지 설명한 글

작성자가 노드 라이브러리 개발자에게 권하는 가이드라인

1. CJS 버전을 제공하고

2. CJS 위에 thin ESM Wrapper를 제공한뒤

3. package.json 에 exports 추가

물론 ESM이 더 최신 방법이지만, 변경사항이 많고 CJS 위에 ESM 래퍼를 제공하는게 더 쉬우니 이게 현재로선 가장 나은 방법인거 같다고.

## Comments



_No public comments on this page._
