React-Native
[ReactNative] 배포시 console.log 없애기
살다보니개발자
2023. 1. 14. 14:29
yarn add -D babel-plugin-transform-remove-console
또는
npm i babel-plugin-transform-remove-console --save-dev
babel-plugin-transform-remove-console 을 설치해준다.
그리고 babel.config.js 에 있는 env.production 에
module.exports = function () {
return {
// ... other project config such as presets and plugins
env: {
production: {
plugins: ['transform-remove-console']
}
}
};
};
이렇게 추가해준다.
그럼 배포시 console은 삭제된다.
잘못된정보가 있으면 언제든 댓글 남겨주세요 태클은 언제나 환영입니다 :)