Vite integration for the Marko Framework — asset manifest resolution and dev-server detection for production builds and HMR.
composer require marko/viteuse Marko\Vite\Vite;
class LayoutController
{
public function __construct(
private readonly Vite $vite,
) {}
public function head(): string
{
return $this->vite->headTags('app/web/resources/js/app.js');
}
}In dev (vite.useDevServer = true), this emits <script type="module"> tags pointing at the Vite dev server. In production, it reads public/build/.vite/manifest.json and emits hashed <script>, <link rel="stylesheet">, and <link rel="modulepreload"> tags.
Full usage, API reference, and examples: marko/vite