laravelnpmlaravel-mixlaravel-valet

valet local domain with browser sync Laravel mix


I have load laravel project which runs fine with valet domain something.dev

Tried to implement browser sync with laravel-mix

mix.browserSync({
    proxy: 'something.dev'
});

After running npm run watch it is pointing me to http://localhost:3000/

Can i point to to valet domain instead of localhost:3000 ?

Here is the output of npm run watch

Asset     Size  Chunks             Chunk Names
mix.js  2.59 kB       0  [emitted]  mix
[Browsersync] Proxying: http://something.dev
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.1.131:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.1.131:3001
 --------------------------------------
[Browsersync] Watching files...

Solution

  • I had similar issues myself getting browserSync working with Valet, but the options I use are:

    mix.browserSync({
        proxy: 'something.test',
        host: 'something.test',
        open: 'external'
    });
    

    host overrides any detection of hostname in browserSync

    open tells it which URL to open (local by default)