title: How to set process.env before a browserified script is run?
body: <p>The initial <code>html</code> comes from the back-end. The server has a defined <code>process.env.NODE_ENV</code> (as well as other environment variables). The browserified code is <strong>built once</strong> and <strong>runs on multiple environments</strong> (<code>staging</code>, <code>production</code>, etc.), so it isn't possible to inline the environment variables into the browserified script (via <code>envify</code> for example). I'd like to be able to write out the environment variables in the rendered html and for browserified code to use those variables. Is that possible?</p>
  
  <p>Here's how I imagine that being done:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script&gt;window.process = {env: {NODE_ENV: 'production'}};&lt;/script&gt;
      &lt;script src="/build/browserified_app.js"&gt;&lt;/script&gt;
    &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>