Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

Emilios1995
Copy link
Contributor

@Emilios1995 Emilios1995 commented Apr 25, 2017

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 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

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. GH Review: review-needed labels Apr 25, 2017
@Emilios1995
Copy link
Contributor Author

cc @mkonicek

@@ -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:
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos done.

@facebook-github-bot facebook-github-bot added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Apr 26, 2017
@facebook-github-bot
Copy link
Contributor

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@henrikra
Copy link

How can I make sure that my production code does not have console.log calls?

thotegowda pushed a commit to thotegowda/react-native that referenced this pull request May 7, 2017
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
@@ -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:

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 ...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants