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
Suggest using babel to remove console.*
calls
#13651
Conversation
cc @mkonicek |
docs/Performance.md
Outdated
@@ -73,6 +73,17 @@ This is unavoidable: a lot more work needs to be done at runtime to provide you | |||
When running a bundled app, these statements can cause a big bottleneck in the JavaScript thread. | |||
This includes calls from debugging libraries such as [redux-logger](https://github.com/evgenyrodionov/redux-logger), | |||
so make sure to remove them before bundling. | |||
You can also use this [babel plugin](https://babeljs.io/docs/plugins/transform-remove-console/) that removes all the `console.*` calls. You need to install it first using `yarn add babel-plugin-transform-remove-console`, and then edit the `.babelrc` file under your project directory like this: |
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.
Can you use npm instead? We're all big fans of Yarn but we haven't yet updated our docs with Yarn instructions, so it's best if we use npm for consistency.
People who've installed Yarn are more likely to be aware of what the equivalent Yarn command is.
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.
@hramos done.
@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
How can I make sure that my production code does not have |
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](facebook@e759573) because the babel plugin [didn't work](facebook#10412). But now it's working well, as reported [here](facebook#10412 (comment)), so it would be helpful to add the suggestion again. Ideally, this would be done automatically, as I suggested in facebook#8337 Closes facebook#13651 Differential Revision: D4954872 Pulled By: hramos fbshipit-source-id: 89ae1b813c50e678f0826f16ef88c8604e13d889
docs/Performance.md
Outdated
@@ -73,7 +73,7 @@ This is unavoidable: a lot more work needs to be done at runtime to provide you | |||
When running a bundled app, these statements can cause a big bottleneck in the JavaScript thread. | |||
This includes calls from debugging libraries such as [redux-logger](https://github.com/evgenyrodionov/redux-logger), | |||
so make sure to remove them before bundling. | |||
You can also use this [babel plugin](https://babeljs.io/docs/plugins/transform-remove-console/) that removes all the `console.*` calls. You need to install it first using `yarn add babel-plugin-transform-remove-console`, and then edit the `.babelrc` file under your project directory like this: | |||
You can also use this [babel plugin](https://babeljs.io/docs/plugins/transform-remove-console/) that removes all the `console.*` calls. You need to install it first with `npm i babel-plugin-transform-remove-console --save`, and then edit the `.babelrc` file under your project directory like this: |
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.
Shouln't it be npm i -D ...
?
This PR adds a suggestion to the docs to use the
transform-remove-console
babel plugin in production to removeconsole.*
calls.This information was previously in the docs, but was removed because the babel plugin didn't work.
But now it's working well, as reported here, so it would be helpful to add the suggestion again.
Ideally, this would be done automatically, as I suggested in #8337