Last active
April 9, 2021 07:17
-
-
Save leejh3224/fb6382be931d3f8f99e4014cbe9025eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 런타임에 특정 패키지를 바라보는 경로를 수정 | |
function alias() { | |
const moduleAlias = require('module-alias') | |
if (process.env.STAGE !== 'local') { | |
return | |
} | |
// 개발자가 로컬 환경에서 실행하는 경우 | |
const cache: any = {} | |
const typeorm = 'typeorm' | |
moduleAlias.addAlias(typeorm, () => { | |
if (cache[typeorm]) { | |
return cache[typeorm] | |
} | |
// symlink를 사용 | |
if (fs.existsSync("path to symlinked typeorm")) { | |
cache[typeorm] = "path to symlinked typeorm" | |
} else { | |
cache[typeorm] = "path to original typeorm" | |
} | |
return cache[typeorm] | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment