title: Accessing NODE_ENV environment variable in React on Rails
body: <p>I've got a <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0ahUKEwjLiZbcv5HTAhWCrlQKHUfPBV4QFggjMAA&amp;url=https%3A%2F%2Fgithub.com%2Fshakacode%2Freact_on_rails&amp;usg=AFQjCNFDDiPMwhIXuYb_KK7C6fd8rxA16w&amp;sig2=BGDX_OnFSzmUbmzJG3z-eA&amp;bvm=bv.152174688,d.cGw" rel="nofollow noreferrer">React on Rails</a> application that hits an API. I want to configure the API endpoint to <code>localhost</code> for development and to my deployed app's URL for production. </p>
  
  <p><strong>client/package.json</strong> </p>
  
  <pre><code> "scripts": {
      "build:production": "NODE_ENV=production webpack --config webpack.config.js",
   },
  </code></pre>
  
  <p><strong>client/webpack.config.js</strong></p>
  
  <pre><code>const devBuild = process.env.NODE_ENV !== 'production';
  
  const config = {
    entry: [
      'es5-shim/es5-shim',
      'es5-shim/es5-sham',
      'babel-polyfill',
      './app/bundles/Main/startup/registration',
    ],
    output: {
      filename: 'webpack-bundle.js',
      path: __dirname + '/../app/assets/webpack',
    },
    resolve: {
      extensions: ['.js', '.jsx'],
    },
    plugins: [
      new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
    ]
  }
  </code></pre>
  
  <p>I see that <code>process.env.NODE_ENV</code> is available in config/webpack.config.js (used here to add source map devtools to the module exports), but I'd like a way to see what the environment is in my React code somewhere in <code>client/</code>. What are my options if any?</p>