title: Angular 2 + Zone.js + Common js module: IF statement anomaly, code is executed even in false case
body: <p>I tried a ton of checks. This definitely is an anomaly. I have an Angular 2 service that loads a <code>@type</code> definition (typescript 2) which in turn loads a commmon.js module (<a href="https://stackoverflow.com/a/39666118/1903781">visionmedia/debug</a>). Inside the common.js module I have a simple if statement that triggers an error even if the condition is false and code should not be executed. The Angular app uses <code>system.js</code> to load modules.</p>
  
  <p><strong>Regular Code</strong> <code>if (false) { console.log('This code is not executed') }</code> 
   Normal behavior, nothing happens</p>
  
  <p><strong>Anomaly Code:</strong> <code>if (false) { exports.humanize = require('ms'); }</code> It triggers 
  <strong>Error:</strong> <code>zone.js:101 GET http://localhost:8002/ms.js 404 (Not Found)</code></p>
  
  <p>The error itself is valid. Indeed that script is not to be found. What is deeply wrong is that it should not appear in the first place. It should be blocked by the false if condition. It seems to me that <code>zone.js</code> somehow parses the the instruction even if the case is false. What can I do to avoid this? I need to check wheter to require one path or another depending if the same script is called on server or on frontend.</p>
  
  <p>Bigger picture inside the CJS module:</p>
  
  <pre><code>// Trying to detect if environment is node.js
  // In backend (no zones) everything works as expected
  // In frontend, the require('ms') statement is executed event if condition is false. 
  // I checked manually if process is defined, it's not. 
  // Event the basic `false` condition also fails to block code.
  if (typeof process === 'undefined') { 
      exports.humanize = require('node_modules/ms/index.js');
      console.log('Browser');
  } else {
      exports.humanize = require('ms'); // If I comment this code works as intended
      console.log('Node');
  }
  </code></pre>