title: Import node module conditionally based on node version
body: <p>I'm in a situation where we have different environments running different versions of Node and I would like to be able to conditionally import certain modules based on the version of node that is running.</p>
  
  <p>I tried doing this with the following block of code, but it results in an error </p>
  
  <blockquote>
    <p>'import' and 'export' may only appear at the top level</p>
  </blockquote>
  
  <pre><code>let ver = process.version.slice(1,ver.length).split('.');
  if (parseInt(ver[0]) &lt; 7) {
    import 'babel-polyfill'
  }
  </code></pre>