title: Webpack: process.env undefined using DefinePlugin and DotEnv
body: <p>I would like to get my variable from my .env file but I always get <code>undefined</code> </p>
  
  <p>This is my js code :</p>
  
  <pre><code>require('dotenv').config();
  class Header extends React.Component{
      constructor(props){...}
      render(){
          console.log("NODE ENV", process.env.NODE_ENV);
          console.log("REACT_APP_MYAPP", process.env.REACT_APP_MYAPP);
          ...
     }
  }
  </code></pre>
  
  <p>This prints :</p>
  
  <blockquote>
    <p>NODE_ENV development</p>
    
    <p>REACT_APP_MYAPP <code>undefined</code></p>
  </blockquote>
  
  <p>In my package.json there is :</p>
  
  <pre><code>"scripts":{
        "start" : "webpack-dev-server --config webpack.dev.js",
        "build" : "webpack --config webpack.prod.js"
   }
  </code></pre>
  
  <p>And in my webpack.dev.js:</p>
  
  <pre><code>const webpack = require("webpack");
  const merge = require("webpack-merge");
  const path = require("path");
  const common = require("./webpack.common.js");
  
  module.exports = merge.smart(common, {
      devServer: {
          contentBase: path.resolve(__dirname, "dist"),
          hot: true,
          overlay: {
              warnings: true,
              errors: true
          },
          inline :true,
          historyApiFallback: true,
          port: 8085
      },
      devtool: "inline-sourcemap",
      optimization: {
          namedModules: true
      },
      plugins: [
          new webpack.HotModulReplacementPlugin(),
          new webpack.DefinePlugin({
              "process.env.NODE_ENV": JSON.stringify("development"),
              "process.env.REACT_APP_MYAPP": JSON.stringify(process.env.REACT_APP_MYAPP)
          })
      ],
      mode: "development"
  });
  </code></pre>
  
  <p>And I placed my .env file at the root of my project, next to webpack.dev.js and package.json:</p>
  
  <blockquote>
    <p>REACT_APP_MYAPP=<a href="http://localhost:8080/" rel="noreferrer">http://localhost:8080/</a></p>
  </blockquote>
  
  <p>So I think, it doesn't success to get the variable in the file.</p>
  
  <p>How can I get the <strong>REACT_APP_MYAPP</strong> value in the code please ?</p>