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

Can we add drop_console to webpack.config.prod.js ? #3243

Closed
iinsta opened this issue Oct 5, 2017 · 4 comments
Closed

Can we add drop_console to webpack.config.prod.js ? #3243

iinsta opened this issue Oct 5, 2017 · 4 comments

Comments

@iinsta
Copy link

iinsta commented Oct 5, 2017

Is this a bug report?

No. This is a feature request. if we can add drop_console to webpack.config.prod.js#L288-L296 here, and add a .env field like DROP_CONSOLE=true to toggle this feature, default is false. Then it's more flexible.

@iinsta
Copy link
Author

iinsta commented Oct 5, 2017

Ref issues/934

@gaearon
Copy link
Contributor

gaearon commented Nov 3, 2017

I don't think this is necessary. If you really want to conditionally output come console statements, put them into conditions:

if (process.env.NODE_ENV !== 'production') {
  console.log('...');
}

@gaearon gaearon closed this as completed Nov 3, 2017
@brandonburkett
Copy link

It would be nice if console.debug was stripped in prod w/o having to wrap in an if check.

@p3nGu1nZz
Copy link

Try creating a log class that wraps console API. Then include the env check to automagically skip logging if prod. There are also logging modules that can do this too.

@facebook facebook locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants