PHP-Vite-MPA
October 2, 2024 · View on GitHub
Example MPA based on mindplay/vite.
How does it work?
-
The
clientfolder contains the client-side sources. -
The
publicfolder is the public webroot. -
In production mode, Vite publishes compiled sources from
clientintopublic/dist. -
In development mode, Vite runs as a proxy server in front of PHP, enabling HMR.
-
The
serverfolder contains theindex.phpfront-controller. -
In
index.php, themindplay/vitepackage is used to parsemanifest.jsonand emit tags.
Have a look in index.php and vite.config.ts for more comments and explanations.
Install
nvm use
composer install
Local Development
composer start
⚠️ NOTE: Vite displays the wrong URL on startup - you must remove /dist from the URL after opening. (if you know how to fix this, please open an issue or PR in the main repository.)
Production Preview
composer preview
Production Build
composer build