We serve an index.php as base file for most of our projects (due to frameworks and some other reasons), so we don`t need (want) a node js server running to serve our application index. Currently i have the Hot Server running in the background at port 3000, and the index.php loads the bundle.js script from this server (via the port). this works fine, but no HMR. ;(
Can anybody point me in the right direction?
PHP does not have a native solution, I don't know about webpack, but I have use browsersync for reloading my application, be it Php, python or javasctipt. I have a browsersync watcher, this watcher tracks my file chnges and then runs my unit tests before reloading the application. If I get an error, a fancy little notification warns me about the error.
Marcus Pohorely
CTO/CEO @Pagelanes.com
Matthew Reschke
There is no good solution yet...I have seen this https://github.com/dolbex/webpack-laravel but you have to run 3 servers...yuck. Its all because PHP runs from nginx or apache, not nodejs so it has no concept of the interactions required for HMR. Only solution I could every see is if someone made a nodejs based PHP server (basically nginx written in nodejs), just so you can server all the regular webpack HMR from nodejs AND have it proxy all PHP calls to PHP-FPM. Something like https://github.com/bergie/dnode-php