1
votes
  • There is the second warning: warning in ./src/main.js "export 'default' (imported as 'Vue') was not found in 'vue'.

  • It's showing me blank site, something could be wrong with router and here is script of my App.vue (not sure about this):

import router from '@/router' export default{ }

And here is my index.js:

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home.vue'
Vue.use(VueRouter)

const routes = [
 {
    path: '/',
    name: 'home',
    component: Home
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
router.beforeEach((to, from, next)=>{
  next();
})
export default router

And main.js:

import Vue from 'vue';
import App from './App.vue';
import router from './router';

new Vue({
    router,
    render: h => h(App)
  }).$mount('#app')
2

2 Answers

0
votes

If using Vue router 4, do this:

...
const router = VueRouter.createRouter({
...
0
votes

I got same problem.this way can solve that.

import {createRouter, createWebHistory} from "vue-router";
const router = createRouter({
    
    history: createWebHistory(),
    routes
})

I'm new in vue,i found it in sample of vue-router.

https://codesandbox.io/s/nested-views-vue-router-4-examples-hl326?initialpath=/users/eduardo&file=/src/router.js