ES6 문법이 도입됨에 따라 node.js에서 import/export 문법을 사용할 수 있게 됐다. 그렇다면 import/export와 require/module.exports의 차이점은 무엇일까? import/export에 대해 설명하기 전에 require과 module.exports에 대해 알아보자. ES6 문법이 도입되기 전의 모듈 시스템은 CommonJs 방식이라고 한다. CommonJs 방식에서 모듈을 내보내는 방법은 exports와 module.exports 두 가지 방식이다. 두 가지 방식의 차이점은 없다! 공식 문서에 따르면 exports는 module 객체의 exports를 참조하는 것 뿐이다. // test.js exports.test = function () { console.log..