JS 라이브러리를 만들때 개발시엔 invariant check를 위해 assert를 쓰되, 배포할땐 빼고싶거든요. 어떤 좋은 방법이 있을까요?
@bglbgl gwyng 앞서 시니하님이 말한 deadcode elimination 어프로치가 좀 더 일반적으로 사용되는 것 같긴 해요. 이 방법이 여의치 않다면, 번들러에서 프로덕션 빌드할 때 주입하는 모듈을 교체하는 식으로도 수행해볼 수 있을 것 같습니다.
If you have a fediverse account, you can quote this note from your own instance. Search https://hackers.pub/ap/notes/01985dca-028f-7272-a2b1-8b06a6ff3a06 on your instance and quote it. (Note that quoting is not supported in Mastodon.)