How to setup inertia on my project, gives me an error when I try and load the login page
@inertia
blade directive is working but not rendered because you need to install the frontend adapter
npm install @inertiajs/inertia @inertiajs/inertia-vue
Set it up in webpack.mix.js
const mix = require('laravel-mix')const path = require('path')mix.js('resources/js/app.js', 'public/js') .webpackConfig({ output: { chunkFilename: 'js/[name].js?id=[chunkhash]' }, resolve: { alias: { vue$: 'vue/dist/vue.runtime.esm.js', '@': path.resolve('resources/js'), }, }, })
And initialize it in Vue resources/js/app.js
import { InertiaApp } from '@inertiajs/inertia-vue'import Vue from 'vue'Vue.use(InertiaApp)const app = document.getElementById('app')const pages = { 'Auth/Login': require('./Pages/Auth/Login.vue').default,}new Vue({ render: h => h(InertiaApp, { props: { initialPage: JSON.parse(app.dataset.page), resolveComponent: name => pages[name], }, }),}).$mount(app)