npm list --depth=0)node -v): 8.11.3npm -v): 6.2.0Within config.js I notice that hmrOptions {} are hard coded to only serve on localhost:8080.
When developing on a remote system or virtual guest OS it would be good to have hmr run on the host/port specified by the run hot parameters such as:
$ npm run hot --host 192.168.56.2 --port 8080
Use
mix.options({
hmrOptions: {
host: 'bla'
port: 8081
}
})
This should be documented here
https://github.com/JeffreyWay/laravel-mix/blob/master/docs/hot-module-replacement.md
I actually dropped this in, so it uses the --host option. But there's probably a tidier way.
/**
* Hostname and port used for the hot reload module
*
* @type {Object}
*/
hmrOptions: {
host: (process.argv.includes('--host')) ? process.argv[process.argv.indexOf('--host')+1] : 'localhost',
port: '8080'
},
But now I see @schniper comment which is more elegant and doesn't require source editing or a PR.
Totally agree that it should be added into the documentation
Laravel Mix documentation is now at laravel-mix.com.
Added a section about setting the hmrOptions with mix.options here.
Sorted thanks.
Most helpful comment
This should be documented here
https://github.com/JeffreyWay/laravel-mix/blob/master/docs/hot-module-replacement.md