I’ve just noticed that resently another Kirby Vite plugin has been shared by @flokosiol but still wanted to share my solution:
Kirby Vite is a set of vite helper functions that work both with single page und multi page setups.
<html>
<head>
<?= vite()->client() ?>
<?= vite()->css() ?>
</head>
<body>
<?= vite()->js() ?>
</body>
</html>
Use one of the kits to get started:
Together with vite live reload plugin your dev server gets also reloaded as soon as you change a kirby specific file:
liveReload('public/site/(templates|snippets|controllers|models)/**/*.php')