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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners