Are you using laravel mix 6? Version 5 has a few issues
Feb 2, 2022
7
Level 2
InertiaJS Unable to show page content
This code snippet from InertiaJS docs doesn't work. Blank page on both Vue and ReactJS. No console errors and by inspecting elements the component is mounted.
import { render } from 'react-dom'
import { createInertiaApp } from '@inertiajs/inertia-react'
createInertiaApp({
resolve: name => require(`./Pages/${name}`),
setup({ el, App, props }) {
render(<App {...props} />, el)
},
})
But the following from a blog post works for ReactJS.
import React from 'react'
import { render } from 'react-dom'
const app = document.getElementById('app')
render(
<InertiaApp
initialPage={JSON.parse(app.dataset.page)}
resolveComponent={name => import(`./Pages/${name}`).then(module => module.default)}
/>,
app
)
Anything wrong with the official code snippet ?
Level 102
@kenprogrammer You have installed vue 2 https://github.com/kenprogrammer/inertiajs-vue-test-app/blob/master/package.json#L18
but you are compiling as if it is v3? https://github.com/kenprogrammer/inertiajs-vue-test-app/blob/master/webpack.mix.js#L8
1 like
Please or to participate in this conversation.