Vite + InertiaJs + Vue - Broken Default layouts
See original GitHub issue- Laravel Vite Plugin Version: 0.2.3
- Laravel Version: 9.19.0
- Node Version: 16.14.2
- NPM Version: 8.5.0
Description:
I’m still testing it and trying to find a solution but obviously because of resolvePageComponent is returning Promise, it doesn’t load layout prop.
import Layout from './AppLayout.vue'
createInertiaApp({
resolve: name => {
const page = resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue'))
page.layout = Layout
return page
}
},...)
Steps To Reproduce:
Reffering to the docs of Inertia https://inertiajs.com/pages#default-layouts try to add default layout in app.js together with laravel-vite plugin. On the other hand, defining layout in Page/**.vue loads AppLayout correctly.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Default Persistent Layout In Laravel + Inertia + Vite
Layouts /DefaultLayoutFile.vue'. You can use the following code to get default layout working with Inertia and Vite:
Read more >Vite + Inertia.js persistent layouts - Laracasts
I use react but vue should be a matter of following the guide as well ... What I want is to set a...
Read more >Pages - Inertia.js
If you're using persistent layouts, it's possible to set a default page layout in the resolve callback. import Layout from './Layout' createInertiaApp({ resolve ......
Read more >Support persistent layouts in Vue 3's setup sugar #651 - GitHub
When using the setup sugar (RFC), we can't use persistent layouts, because there is no way to set a property ( layout in...
Read more >Asset Bundling (Vite) - The PHP Framework For Web Artisans
The default package.json file already includes everything you need to get started using Vite and the Laravel plugin. You may install your application's ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try this (notice
page.default.layout
):Ohh you… you clever person 👍Indeed that was the solution for my issue. Hope that this topic will help others.