Did you forget to import react?
import React from 'react'
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I followed this guide: https://dev.to/kodeas/using-vite-with-inertia-laravel-vue-tailwind-2h5k
The difference: I need to react
Everything seems fine except for this section:
import { InertiaProgress } from '@inertiajs/progress'
...
InertiaProgress.init()
createInertiaApp({
resolve: name => {
const page = require(`./Pages/${name}`).default
if(page.layout === undefined && name.startsWith('SuperAdmin/Company/')){
page.layout = page => (<AdminLayout>
<LayoutCompany>{page}</LayoutCompany>
</AdminLayout>)
}
...
return page;
},
setup({ el, App, props }) {
render(<App {...props} />, el)
},
})
I get the following error
> resources/js/app.js:15:35: error: Unexpected "<"
15 │ page.layout = page => (<AdminLayout>
╵
What can help?
I found the right answer
I have worked so far with mix
And the file extensions are js
vite requires jsx extensions
Please or to participate in this conversation.