-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable logs for staging and production native apps #30875
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,16 +17,8 @@ const defaultPlugins = [ | |
]; | ||
|
||
const webpack = { | ||
env: { | ||
production: { | ||
presets: defaultPresets, | ||
plugins: [...defaultPlugins, 'transform-remove-console'], | ||
}, | ||
development: { | ||
presets: defaultPresets, | ||
plugins: defaultPlugins, | ||
}, | ||
}, | ||
presets: defaultPresets, | ||
plugins: defaultPlugins, | ||
}; | ||
|
||
const metro = { | ||
|
@@ -78,6 +70,11 @@ const metro = { | |
}, | ||
], | ||
], | ||
env: { | ||
production: { | ||
plugins: ['transform-remove-console', {exclude: ['error', 'warn']}], | ||
}, | ||
}, | ||
Comment on lines
+73
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should preserve, the That's why I've opted to keep them (exclude them from removal) here |
||
}; | ||
|
||
/* | ||
|
@@ -102,11 +99,19 @@ if (process.env.CAPTURE_METRICS === 'true') { | |
]); | ||
} | ||
|
||
module.exports = ({caller}) => { | ||
module.exports = (api) => { | ||
console.debug('babel.config.js'); | ||
console.debug(' - api.version:', api.version); | ||
console.debug(' - api.env:', api.env()); | ||
console.debug(' - process.env.NODE_ENV:', process.env.NODE_ENV); | ||
console.debug(' - process.env.BABEL_ENV:', process.env.BABEL_ENV); | ||
Comment on lines
+102
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've included these logs, because I've found out that when we're building the production web release, the environment output is |
||
|
||
// For `react-native` (iOS/Android) caller will be "metro" | ||
// For `webpack` (Web) caller will be "@babel-loader" | ||
// For jest, it will be babel-jest | ||
// For `storybook` there won't be any config at all so we must give default argument of an empty object | ||
const runningIn = caller((args = {}) => args.name); | ||
const runningIn = api.caller((args = {}) => args.name); | ||
console.debug(' - running in: ', runningIn); | ||
|
||
return ['metro', 'babel-jest'].includes(runningIn) ? metro : webpack; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env.production
path were never engaged for web builds. The reason being,NODE_ENV
isn't defined before initiating the build process.In essence, this modification aligns the dev and prod configurations, making them the same, hence the presented code change.