Open
Conversation
Comment on lines
+10
to
+14
| const isProduction = process.env.NODE_ENV === 'production'; | ||
|
|
||
| if (isProduction && stripDebugLogs) { | ||
| console.log("Babel: Stripping debug calls from production build"); | ||
| plugins.push('./plugins/babel-plugin-strip-debug-calls.js'); |
There was a problem hiding this comment.
Bug: The Babel config requires both STRIP_DEBUG_LOGS and NODE_ENV === 'production', but NODE_ENV is not set during local EAS production builds, preventing log stripping.
Severity: MEDIUM
Suggested Fix
Rely on a single source of truth for enabling the plugin. Either use api.caller() as suggested by the code comment to detect the build mode, or only check process.env.STRIP_DEBUG_LOGS, which is correctly configured in eas.json for different build profiles. This will ensure consistent behavior across local and CI/CD builds.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: babel.config.js#L10-L14
Potential issue: In `babel.config.js`, the `transform-remove-console` plugin is only
enabled if both `stripDebugLogs` and `isProduction` are true. The `isProduction` flag
relies on `process.env.NODE_ENV === 'production'`. During a local EAS production build
(e.g., `eas build --local --profile production`), `eas.json` correctly sets
`STRIP_DEBUG_LOGS`, but `NODE_ENV` is not set and may default to `'development'`. This
causes the `isProduction` check to fail, preventing the plugin from running and leaving
debug logs in production builds created locally. This does not affect CI/CD builds where
`NODE_ENV` is explicitly set.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What does this change do?
Motivation
Why is this change needed?
Testing
pnpm lintpnpm testScreenshots / Video (if UI)
Attach if relevant.