سلام. یه روش دیگه ام اینه که داخل فایل babel.config.js این کد رو بنویسیم
js
module.exports = api => {
const babelEnv = api.env();
const plugins = [];
//change to ‘production’ to check if this is working in ‘development’ mode
if (babelEnv !== ‘development’) {
plugins.push([‘transform-remove-console’, {exclude: [‘error’, ‘warn’]}]);
}
return {
presets: [‘module:metro-react-native-babel-preset’],
plugins,
};
};
چون تو ورژن های جدید دیگه .babelrc نداریم (تو خود داکیومنت ری اکت نیتیو ولی ایپدیت نکردن)
https://stackoverflow.com/a/59499046/7178860