Skip to content

Instantly share code, notes, and snippets.

@blmarket
Created February 14, 2014 03:29
Show Gist options
  • Select an option

  • Save blmarket/8995298 to your computer and use it in GitHub Desktop.

Select an option

Save blmarket/8995298 to your computer and use it in GitHub Desktop.
How to safely move your node.js module to another path.

모듈 파일을 옮길 때 일일이 dependency 체크를 하기 귀찮다면, 일단 옮긴 후에 다음 내용을 넣어 주면 된다.

console.trace();
module.exports = require('새 모듈 경로');

만약 코드의 테스트 커버리지가 충분하다면(적어도 모든 require를 한번 이상은 실행해줘야 이 방법으로 안전하게 모듈을 이전할 수 있다), 테스트를 돌리는 것만으로도 어느 모듈에서 해당 모듈을 참조하고 있었는지 나열해주기 때문에, 그것들만 찾아가면서 수정해주면 된다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment