Uh oh!
There was an error while loading. Please reload this page.
remove console calls on production - #8337
Conversation
ghost
commented
Jun 22, 2016
Emilios1995
commented
Jun 22, 2016
ac1e87a to
326053cCompareEmilios1995
commented
Jun 23, 2016
Notice: The commit was amended to simplify my original transform function. |
Thanks, @Emilios1995, I'll post this internally at FB to ask teams if this affects them in any way and get back to you. |
javache
commented
Jun 23, 2016
We should keep console.error since that provides non-fatal error logging. You should also verify this doesn't break our console polyfill code and console error reporter code. |
javache
commented
Jun 23, 2016
Emilios1995
commented
Jun 23, 2016
There was a problem hiding this comment.
Instead of creating a new function object each time, it might be simpler just to use Function.prototype, which is a no-op function #jstrivia
Emilios1995
commented
Jun 27, 2016
So, @bestander, do you think it's safe to merge? |
bestander
commented
Jun 27, 2016
@Emilios1995, it seems that we use console.log in some products internally even for prod builds. |
Emilios1995
commented
Jun 28, 2016
Well, we could just suggest in the docs to include the official transform-remove-console in the production environment of the user's own .babelrc |
bestander
commented
Jun 29, 2016
Yes, @Emilios1995, I think it is a good idea, want to send a docs PR? |
bestander
commented
Jun 29, 2016
Let's close this for now, feel free to reopen if there are more ideas |
stovmascript
commented
Oct 14, 2016
I tried using I also tested it on another project for the web, which is bundled with webpack and works as expected, so I didn't open an issue at the babel repo yet because it might be RN related. |
Summary: This PR adds a suggestion to the docs to use the `transform-remove-console` babel plugin in production to remove `console.*` calls. This information was previously in the docs, but was [removed](e759573) because the babel plugin [didn't work](#10412). But now it's working well, as reported [here](#10412 (comment)), so it would be helpful to add the suggestion again. Ideally, this would be done automatically, as I suggested in #8337Closes#13651 Differential Revision: D4954872 Pulled By: hramos fbshipit-source-id: 89ae1b813c50e678f0826f16ef88c8604e13d889
This adds to the
productionmode ofbabel-preset-react-native, a plugin to delete calls to theconsolewhile still preserving the side effects inside them.The motivation is the great improvement on performance on the code running on device after removing the calls to
consolemethodsNote that although the plugin works as expected, I don't know if this could cause any inconveniences on the rest of the system.