title: Router not working when moving code into helper file
body: <p>I tried to create some organization in my Vue app, so I moved my router confirguration to a separate file:</p>
  
  <pre><code># /_helpers/router.js
  
  import Vue from 'vue';
  import VueRouter from 'vue-router';
  import MemberDetail from '../MemberDetail';
  import LoginPage from '../LoginPage';
  
  Vue.use(VueRouter)
  
  const routes = [
    { path: '/', component: MemberDetail },
    { path: '/login', component: LoginPage },
  ];
  
  export const router = new VueRouter({routes});
  
  router.beforeEach((to, from, next) =&gt; {
    // redirect to login page if not logged in and trying to access a restricted page
    const publicPages = ['/login'];
    const authRequired = !publicPages.includes(to.path);
    const loggedIn = localStorage.getItem('user');
  
    if (authRequired &amp;&amp; !loggedIn) {
      return next('/login');
    }
  
    next();
  }) 
  </code></pre>
  
  <p>Then I add the exported router in my main application.js:</p>
  
  <pre><code>import Vue from 'vue/dist/vue.esm'
  import App from '../components/app.vue'
  import { router } from '../components/_helpers';
  
  document.addEventListener('DOMContentLoaded', () =&gt; {
    new Vue({
        el: '#app',
        router,
        render: h =&gt; h(App)
    });
  })
  </code></pre>
  
  <p>In my App.vue, I try to display the router-view:</p>
  
  <pre><code>&lt;template&gt;
    &lt;div class="page-container"&gt;
      &lt;router-view&gt;&lt;/router-view&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  
  export default {
    name: 'app'
  };
  &lt;/script&gt;
  
  &lt;style scoped&gt;
  &lt;/style&gt;
  
  </code></pre>
  
  <p>Unfortunataly this results in the following error: </p>
  
  <pre><code>[Vue warn]: Unknown custom element: &lt;router-view&gt; - did you register the component correctly? For recursive components, make sure to provide the "name" option.
  </code></pre>
  
  <p>I don't understand what's wrong... I'm adding the router to the new Vue call, so I think it should be available.</p>
  
  <p>Thanks</p>