title: Environment variables in Typescript with Webpack
body: <p>I am having trouble declaring globals in Typescript, using Webpack's DefinePlugin. I was hoping to get some input on what I am doing wrong.</p>
  
  <p>I created an environment variable in my <code>.bash_profile</code>: </p>
  
  <pre><code>export API_KEY_GOOGLE_MAPS=xxxxxxxxxxxxxxxx
  </code></pre>
  
  <p>In my webpack.config.js, I have the following lines:</p>
  
  <pre><code>...
  plugins: [
    new webpack.DefinePlugin({
      API_KEY_GOOGLE_MAPS: JSON.stringify(process.env.API_KEY_GOOGLE_MAPS),
    }),
  ],
  ...
  </code></pre>
  
  <p>Inside <code>index.tsx</code> (I am using React), I do the following:</p>
  
  <pre><code>declare var API_KEY_GOOGLE_MAPS: string;
  
  console.log(API_KEY_GOOGLE_MAPS)
  </code></pre>
  
  <p>This produces the following error, at the line containing <code>console.log</code>: </p>
  
  <pre><code>ReferenceError: API_KEY_GOOGLE_MAPS is not defined
  </code></pre>
  
  <p>Does anybody have any leads?</p>