title: how to use webpack to load CDN or external vendor javascript lib in js file, not in html file
body: <p>I am using react starter kit for client side programming. It uses react and webpack. No index.html or any html to edit, all js files. My question is if I want to load a vendor js lib from cloud, how to do I do that?</p>
  
  <p>It would be easy to do that in a html file. <code>&lt;script src="https://forio.com/tools/js-libs/1.5.0/epicenter.min.js"&gt;&lt;/script&gt;</code></p>
  
  <p>However, in js file, it only uses npm installed packages. How can I import the above lib with no html file? I tried import and require, they only work for local files.</p>
  
  <p>update 10/21/15
  So far I tried two directions, neither is ideal.</p>
  
  <ol>
  <li>@minheq yes there is a html file sort of for react start kit. It is html.js under src/components/Html. I can put cloud lib and all its dependencies there like this:</li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>        &lt;div id="app" dangerouslySetInnerHTML={{__html: this.props.body}} /&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://forio.com/tools/js-libs/1.5.0/epicenter.min.js"&gt;&lt;/script&gt;
          &lt;script src="/app.js"&gt;&lt;/script&gt;
          &lt;script dangerouslySetInnerHTML={this.trackingCode()} /&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>Good news is it works, I don't need do anything else in js file, no import or require. However, now I have two jquery libs loaded in different ways. One in here, the other through npm and webpack. I wonder it will give me trouble later. The react-routing I use give me 'undefined variable' error if I type a none home path in browser window due to the server side loading I guess. So this solution is not very good.</p>
  
  <ol start="2">
  <li>Use webpack externals feature. This is documented as: <a href="https://webpack.github.io/docs/library-and-externals.html">link</a>. "You can use the externals options for applications too, when you want to import an existing API into the bundle. I.e. you want to use jquery from CDN (separate  tag) and still want to require("jquery") in your bundle. Just specify it as external: { externals: { jquery: "jQuery" } }." 
  However, the documentation I found a few places are all fussy about how to do this exactly. So far I have no idea how to use it to replace <code>&lt;script src="https://forio.com/tools/js-libs/1.5.0/epicenter.min.js"&gt;&lt;/script&gt;</code> in html.</li>
  </ol>