Which line is it complaining about? This?
import VueRouter from "vue-router";
Cause that looks correct
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Anyone can tell me what's wrong in here?
Note that I'm absolutely newbie in Vue.
--
The error I'm getting (From the import of VueRouter in routes.js)
Uncaught SyntaxError: import not found: default
routes.js
import VueRouter from "vue-router";
import ExampleComponent from './components/ExampleComponent.vue';
const routes = [
{
path: '/',
component: ExampleComponent
}
];
const router = new VueRouter({
routes,
});
export default router;
app.js
require('./bootstrap');
import router from './routes.js';
window.Vue = require('vue').default;
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
const app = new Vue({
el: '#app',
router
});
Thanks in advance!
Please or to participate in this conversation.