title: Conditionally import modules in ES6
body: <p>I'm working on library for React with free and pro components with rollup for production and webpack for dev. I want to reuse one component but with less variations for free version. Code below was working so far, but if we think about ssr and tree-shaking support with rollup, we have to use es6 imports (at least so far as i know).
  Any ideas how to import module if it exists -> if not - import another module?</p>
  
  <pre class="lang-js prettyprint-override"><code>let DropdownMenuComponent;
  try {
    DropdownMenuComponent = require("./pro/DropdownMenuProComponent").default;
  } catch (err) {
    DropdownMenuComponent = require("./DropdownMenuComponent").default;
  }
  </code></pre>
  
  
  
  <p>I have tried dynamic import, but it did not catch errors properly, while the module was missing.</p>
  
  <p>Thanks</p>