Today I Learned

How to exclude code from production in build time

Sometimes you may want to add some code which will be available only in development, but you don’t want to mess your bundle with a dead code. You can do this with webpack version 4. Setting mode to production in your webpack config will remove any code that is not designed for selected environment.

if (process.env.NODE_ENV === 'development') {
  console.warn('This block will be removed during building you bundle')
}