VueRouter is a default export not named.
import VueRouter from 'vue-router'
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Im using VueJs and Laravel8 and i want to import vue-router. Her is my app.js code
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
require('@fortawesome/fontawesome-free/js/all.js');
window.Vue = require('vue');
//Import View Router
import Vue from 'vue';
import {VueRouter} from 'vue-router';
import routes from './routes';
Vue.use(VueRouter);
//Import Form
import Form from './Form';
window.Form = Form;
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
Vue.component('pagination', require('laravel-vue-pagination'));
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
Vue.component('home-page', require('./home/Home.vue').default);
Vue.component('product-page', require('./produits/Produit.vue').default);
Vue.component('createproduit-page', require('./produits/CreateProduit.vue').default);
Vue.component('editproduit-page', require('./produits/EditProduit.vue').default);
Vue.component('showproduit-page', require('./produits/ProduitShow.vue').default);
Vue.component('produitlist-page', require('./produits/ProduitsList.vue').default);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const app = new Vue({
el: '#app',
router: new VueRouter(routes),
components: { App },
});
and my route.js
import Test from './produits/Test.vue'
export default {
mode: 'history',
routes: [{
path: '/Test',
component: Test,
}]
}
somehow i get the error
WARNING in ./resources/js/app.js :
"export 'VueRouter' was not found in 'vue-router'
@ multi ./resources/js/app.js ./resources/sass/app.scss ./resources/sass/style.scss
Please help me, I have already searched in vain on the internet for 2 weeks already
I had the solution to my problem.
i had not set up the dependency of bootstrap-vue properly, it was in my package.jason, but not the dependency file, I had to install it via npm install bootstrap-vue.
Thank you very much for your help.
Please or to participate in this conversation.