Source: sebastiandedeyne.com

Vite with Laravel: Using Inertia.js

Category: Laravel, Laravel, javascript, javascript

Time for the last—and my favorite—post in the Vite series: using Inertia.js. Inertia suggests two ways to resolve views in the docs: with require or with import.

One little catch compared to usign it with Webpack: with Vite, you must specify the extension in the import template literal.

If you’d rather bundle your pages in a single file (similar to using require with Webpack) you can use import.meta.globEager instead.

In one of our projects, we use the following structure: In this case, we only want to bundle components in views folders as pages.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners