Log a warning when in development mode

See original GitHub issue

Do you want to request a feature or report a bug?

  • feature

Ref this tweet from Dan - https://twitter.com/dan_abramov/status/775647965197336576

It’s currently too easy to use React in development mode while in production, and there’s little warning from the library that this is happening. Further, it takes a fair bit of googling to know what to do, (it’s tucked away under ‘advanced performance’ in the docs, and doesn’t include directions for webpack/browserify).

As a start, I recommend that react always log a message to console when it’s in development mode. Something like -

“running in development mode, use production mode flags to speed up your code”

This stands out, and I hope will prevent some, if not most, of these misses.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Sep 13, 2016

However, I thought we already had a warning for when you’re running development mode in a minified bundle?

Good point, I forgot about that one! It seems like some people don’t read logs in production then.

Logging a warning in development would serve to educate them about different development/production modes. We already have a warning about DevTools so maybe we could change its wording to also make it clear this is dev version of React itself, and always show it?

0reactions
gaearoncommented, Oct 4, 2017

We now warn in DevTools and it’s been working well. We also have docs about it now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Inferno is in development mode." log in every Test Suit
Hi,. The You are running production build of Inferno in development mode. Use dev:module entry point. warning appears because the production ...
Read more >
console.log only in development mode Angular 2
This approach is just add an extra layer of delaing with console object and you need to inject the logger service in every...
Read more >
Development and production modes - Expo Documentation
Development mode includes useful warnings and gives you access to tools that make development and debugging easier. Production mode minifies your code and ......
Read more >
Log messages in the Console - Chrome Developers
Each console.* method is assigned a severity level: Verbose , Info , Warning , or Error . For example, ...
Read more >
Disable "You are running Vue in development mode" warning
Disable "You are running Vue in development mode" warning ... Hi,. I'm using Vue in a fresh install of Laravel. In the console...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found