title: Conditional importing of components in Vue Router
body: <p>I have this issue, I want to import different components on same route.</p>
  
  <p>This works fine</p>
  
  <pre><code>import Mycomponent from '@/views/Mycomponent'
  
  {
    name: 'My component name',
    path: somepath,
    component: Mycomponent,
  }
  </code></pre>
  
  <p>This  doesn't  work</p>
  
  <pre><code>import Mycomponent from '@/views/Mycomponent'
  import MycomponentDifferent from '@/views/MycomponentDifferent'
  
  {
    name: 'My component name',
    path: somepath,
    component: () =&gt; {
      if(true) {
       console.log(Mycomponent) // You can see in console whole component
       return Mycomponent
      } else {
       return MycomponentDifferent
      }
    }
  }
  </code></pre>
  
  <p>and this is also not working</p>
  
  <pre><code>import Mycomponent from '@/views/Mycomponent'
  
  {
    name: 'My component name',
    path: somepath,
    component: () =&gt; {
      return HomepageView
    }
  }
  </code></pre>