andrefelipe / vite-php-setup

Example on how to run Vite on traditional PHP sites
https://github.com/vitejs/vite
358 stars 52 forks source link

npm run dev issue #8

Closed Sensei85 closed 2 years ago

Sensei85 commented 2 years ago

my-php-project@0.0.0 dev C:\wamp64\www\vite-php-setup\vite APP_ENV=development vite

'APP_ENV' is not recognized as an internal or external command, operable program or batch file.

Please help. Running npm run gives this issue. Great work by the way and is it possible to make it work with svelte instead of view

andrefelipe commented 2 years ago

That should be related to Windows. This may be your answer, check the comments too: https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows

Sensei85 commented 2 years ago

Thanks @andrefelipe , appreciate the help. Also is there a way we can make it work with svelte. So you can use svelte components instead of vue. And looks like it's only when the index file changes that the HMR kicks in, how about to watch for any file with ".php" change, and when saved HMR reloads the browser page for you. That would be neat. Thanks again for this repo, really helped me

andrefelipe commented 2 years ago

The PHP refresh is already set up with liveReload plugin. Please check the vite.config.js

For svelte should be simple take a look on Vite docs https://vitejs.dev and repo https://github.com/vitejs/vite

Sensei85 commented 2 years ago

Thanks, will share a repo when I finally learn vite configs and get it to work with svelte.