Level 1
more details above
-----package.json-------
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"vite": "^4.0.0"
},
"dependencies": {
"@inertiajs/vue3": "^1.0.2",
"@vitejs/plugin-vue": "^4.1.0",
"vue": "^3.2.36",
"vue-loader": "^17.0.1"
}
}
------app.js-----
import './bootstrap';
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
createInertiaApp({
resolve: name => {
const pages = import.meta.glob('./Pages/**/*.vue', { eager: true })
return pages[`./Pages/${name}.vue`]
},
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.mount(el)
},
})
-----vite.config.js-----
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [
vue(),
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});
------ app.blade.php -----
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
@vite('resources/js/app.js')
@inertiaHead
</head>
<body>
@inertia
</body>
</html>
and finally below is the page view source
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script type="module" src="http://[::1]:5174/@vite/client"></script><script type="module" src="http://[::1]:5174/resources/js/app.js"></script> </head>
<body>
<div id="app" data-page="{"component":"app","props":{"errors":{}},"url":"\/","version":""}"></div> </body>
</html>
kindly please help me