Laravel-Mix + BrowserSync Not Loading at localhost:3000

13,357

Solution 1

Install these two plugins:

  1. "browser-sync": "^2.26.5"
  2. "browser-sync-webpack-plugin": "^2.0.1",

mix.browserSync('http://localhost:8000/');

Solution 2

I was able to reload via brosersync adding injectChanges: false to my browsersync line.

browsersync documentation

Solution 3

you must do it like so:

mix.browserSync({
    proxy: "http://localhost:8000"
});
Share:
13,357
sleepy_daze
Author by

sleepy_daze

Updated on June 24, 2022

Comments

  • sleepy_daze
    sleepy_daze almost 2 years

    I'm trying to set up BrowserSync to work with my Laravel project. However, when I run npm run watch, localhost:3000 doesn't load. I'm not getting any compilation errors in the terminal. Interestingly enough, the UI dashboard on localhost:3001 works perfectly fine.

    If I run php artisan serve, localhost:8000 loads up fine, but of course, it's not connected with BrowserSync.

    My webpack.mix.js file looks like this:

    mix.js('resources/js/app.js', 'public/js')
        .sass('resources/sass/app.scss', 'public/css');
    
    mix.browserSync({proxy:'localhost:3000'});
    

    I'm using the following versions:

    Laravel-Mix: 4.0.7

    browser-sync: 2.26.7

    webpack-dev-server: 3.8.0

    browser-sync-webpack-plugin: 2.0.1

    Any thoughts?