To achieve this you can use Laravel Mix
- Ensure that Node.js and NPM are installed: run
node -v
andnpm -v
. - Install Laravel Mix
npm install
. - Open webpack.mix.js and add
mix.browserSync('127.0.0.1:8000');
. - Run
php artisan serve
. - And the
npm run watch
.
Yes it is working. And just to help make it a little clearer...
You add
mix.browserSync("127.0.0.1:8000");
to yourwebpack.mix.js
Then run
php artisan serve
then also run
npm run watch
then you set your browser tab to
localhost:3000
and it will auto-refresh the browser every time you save a change in your code editor! Much like running GoLive.HUGE time saver.
PS you can still tune in to
localhost:8000
like normal, you just have to manually refresh the browser yourself.