vite-plugin-mix (v0.4.0) adds a backend API server to your Vite dev server by running a separate process (e.g., PHP, Python, Node) alongside Vite's proxy. Unlike other solutions that require full-stack frameworks or custom middleware, it provides a simple plugin-based approach for mixing Vite with any backend language. It is actively maintained with monthly releases and ships TypeScript definitions. Peer dependency on Vite ^3.0.0.
npm install vite-plugin-mixVerified import paths — ran on the pinned version, not inferred.
Configure Vite to run a PHP backend on port 3001 via vite-plugin-mix.
Upgrade to Vite 3 or use older plugin version compatible with your Vite version.
Ensure your backend script is properly configured and has necessary dependencies installed.
Update to v0.3.0+ and use the 'handler' and 'port' options.
Run npm install vite-plugin-mix@latest and use correct import.
Install Vite 3.x: npm install vite@^3.0.0
Use import mix from 'vite-plugin-mix' (default import).