title: Vue- Import vue components dynamically
body: <p>I have many components, i want to import then on demand. i have a drop down which actually contains components list, that what to load. I tried this example</p>
  
  <pre><code>&lt;component :is="componentLoader"&gt;&lt;/component&gt;
  </code></pre>
  
  <p>in script </p>
  
  <pre><code>componentLoader () {
    return () =&gt; import('@/components/testDynamic') 
  }
  </code></pre>
  
  <p><strong>testDynamic</strong> is a component name(For now i am trying with static component).</p>
  
  <p>Getting this error </p>
  
  <pre><code>GET http://localhost:8080/0.js net::ERR_ABORTED 404
  [Vue warn]: Failed to resolve async component: function () {
      return __webpack_require__.e/* import() */(0).then(__webpack_require__.bind(null, "./src/components/testDynamic.vue"));
    }
    Reason: Error: Loading chunk 0 failed.
  </code></pre>
  
  <p>How to fix this? am i doing any thing wrong? or is there any other way to import components dynamically?</p>