To achieve this you can use Laravel Mix
- Ensure that Node.js and NPM are installed: run
node -vandnpm -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.jsThen run
php artisan servethen also run
npm run watchthen you set your browser tab to
localhost:3000and 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:8000like normal, you just have to manually refresh the browser yourself.