To prevent VITE from starting when running npm run dev, you can modify the package.json file and remove the vite command from the dev script. Here's an example:
"scripts": {
"dev": "php artisan serve",
"watch": "npm run development -- --watch",
"development": "mix",
"production": "mix --production"
},
In this example, the dev script runs the Laravel server using php artisan serve, without starting VITE. You can still use your local web server by accessing it at the specified URL (usually http://localhost:8000).
If you need to use VITE for development, you can create a separate script that starts VITE and your local web server at the same time. Here's an example:
"scripts": {
"dev": "php artisan serve",
"watch": "npm run development -- --watch",
"development": "mix",
"production": "mix --production",
"dev-vite": "npm run dev & vite"
},
In this example, the dev-vite script starts both the Laravel server and VITE using the & operator to run them in parallel. You can then access your local web server at the specified URL and use VITE for development at the same time by running npm run dev-vite.