title: Removing console.logs in development version of React / Redux / MERN-stack application
body: <p>I have two console-logging issues I am trying to resolve here. One is simpler and i can simply comment out a few lines of code to bandaid the problem, but I'd like to ask both here.</p>
  
  <p>First, for redux, in my <code>store.js</code> file I use <code>redux-logger</code> to console.log in production the different actions. Here is my <code>store.js</code> file: </p>
  
  <pre><code>import { createStore, applyMiddleware } from 'redux';
  import thunk from 'redux-thunk';
  import rootReducer from './reducers';
  
  const initialState = {};
  const middleware = [thunk];
  
  if (process.env.NODE_ENV !== `prod`) {
      const { logger } = require(`redux-logger`);
      middleware.push(logger);
  }
  
  const store = createStore(
      rootReducer,
      initialState,
      applyMiddleware(...middleware),
      window.__REDUX_DEVTOOLS_EXTENSION__ &amp;&amp; window.__REDUX_DEVTOOLS_EXTENSION__()
  );
  
  export default store;
  </code></pre>
  
  <p>Unfortunately, the <code>if (process.env.NODE_ENV !==</code>prod<code>) {</code> condition is not working, as the <code>redux-logger</code> outputs are showing up in the version of my app that I deploy on my EC2 instance.</p>
  
  <p>Second, I would like to suppress all <code>console.logs</code> in general in EC2 instance dev version. I have installed this library - <a href="https://www.npmjs.com/package/babel-plugin-transform-remove-console" rel="nofollow noreferrer">https://www.npmjs.com/package/babel-plugin-transform-remove-console</a> - and I created a <code>.babelrc</code> file that looks like this:</p>
  
  <pre><code>{
      "env": {
          "production": {
              "plugins": ["transform-remove-console"]
          }
      }
  }
  </code></pre>
  
  <p>However, even with the library installed and the <code>.babelrc</code> file created, the console.logs appear in the dev version of the app. </p>
  
  <p>Any help with how I can go about debugging each of these problems would be greatly appreciated. For the time being, I am simply commenting out the <code>redux-logger</code> lines of code in the store to remove the logger's output, but I have no way of easily hiding the other console.logs (beyond commenting them out across all of the different components of my app). </p>
  
  <p><strong>Edit</strong>: please let me know if sharing any of the other app files, or looking up version numbers for certain libraries, will help with this!</p>
  
  <p>Thanks!</p>