title: Node process object made available to browser client code
body: <p>I'm trying to understand how webpack uses DefinePlugin. I have:</p>
  
  <pre><code>new webpack.DefinePlugin({
    'process.env.NODE_ENV': JSON.stringify('development'),
  }),
  </code></pre>
  
  <p>and a function:</p>
  
  <pre><code>export const foo = () =&gt; {
    console.log(process)
    console.log(process.env.NODE_ENV)
  }
  window.foo = foo
  </code></pre>
  
  <p>when I print foo, I see the following in my browser console:</p>
  
  <pre><code>ƒ foo() {
    console.log(process);
    console.log("development");
  }
  </code></pre>
  
  <p>It seems like the variable "development" was injected while webpack was compiling the input file. At the same time webpack also injected the process object into the JavaScript code, and the browser did print out the process object when foo was called:</p>
  
  <pre><code>{title: "browser", browser: true, env: {…}, argv: Array(0), nextTick: ƒ, …}
  </code></pre>
  
  <p>My question is, how can the process object, which is a Node concept, be made available to the browser?</p>
  
  <p>In fact, if I do:</p>
  
  <pre><code>window.process = process
  </code></pre>
  
  <p>I can use process.nextTick right inside the browser console! I thought the nextTick function was a Node-specific implementation! Could anybody explain this?</p>
  
  <p>Thank you!</p>