title: How to pass .env file variables to webpack config?
body: <p>I am new to webpack and worked out almost all build sections, but now the problem is that I want to pass the environment variables from a .env file to webpack config, so that I can pass that variables to my build files via <code>webpack.DefinePlugin</code> plugin.</p>
  
  <p>Currently I am able to to pass environment variable directly from webpack to to my build. Please see the code below which I used in webpack.</p>
  
  <pre><code>new webpack.DefinePlugin({
              "API_URL": JSON.stringify("http://my-api.com"),
              "FRONT_END_API_KEY" : "MYFRONTENDKEYGOESHERE"
          }),
  </code></pre>
  
  <p>My <code>package.json</code> build script is</p>
  
  <pre><code>"scripts": {
      "start": "NODE_ENV=development webpack-dev-server --progress --port 8000 --content-base app/build/src"
      } 
  </code></pre>