'How to setup a VueRouter in laravel

A have some problem in laravel 9 - empty page. Console have not any error or warrnings.

"vue": "^3.2.33",
"vue-loader": "^17.0.0"

Thanx a lot!

require('./bootstrap');

import {createApp} from 'vue'
import {createRouter} from 'vue-router'

const router = createRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'home',
            component: Home
        },
        {
            path: '/hello',
            name: 'hello',
            component: Hello,
        },
    ],
});

import App from './components/App'
import Hello from './components/Hello'
import Home from './components/Home'

let app = createApp(App)
app.use(router).mount("#app")

Without prescribing a router, everything works. I don't understand where the error is during the initial setup Vue Router.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source