question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Homestead + BrowserSync doesn't watch view files

See original GitHub issue
  • Laravel Mix Version: 1.0.7
  • Node Version: 8.1.2
  • NPM Version: 5.0.3
  • OS: Win10 + Homestead

Description:

When using the command “npm run watch” or “npm run watch-poll” to update view files, the screen is not reloaded. However for CSS it works normally. This running with Homestead. However, if the commands are executed via Windows10, the view files update normally. I’m not using Windows directly because I use browsersync with other devices on the network, and only via homestead I can do this.

my config (I already tried several paths … I left what works on Windows):

// Configs
let config = {
    host:     '192.168.1.80',
    port:     3000,
    base_url: 'admin.dev',
    watchFiles: [
        'app/Modules/**/Resources/views/**/*.{php,html}',
        'app/Modules/**/Resources/views/*.{php,html}',
        //'app/**/*.*',
        //'public/**/*.*',
        //'resources/assets/**/*.*',
        //'resources/views/**/*.*',
        //'app/Modules/**/Resources/views/**/*.*',
        //'public/css/**/*.*',
        //'public/js/**/*.*',
        //'resources/views/**/*.*',
        //'aap/Modules/**/Resources/views/**/*.*',
        //'app/Modules/**/Resources/views/*.*'
    ]
};

//Browserfy
mix.browserSync({
    files: config.watchFiles,
    host: config.host,
    proxy: config.base_url,
    port: config.port,
    online: true,
    logConnections: false,
    reloadOnRestart: true,
    notify: false,
    open: false //false, local, external, ui, tunnel
});

Steps To Reproduce:

  1. Access Homestead via ssh
  2. Access Project Folder
  3. Run “npm run watch-poll”
  4. Change some view file

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

38reactions
irineujuniorcommented, Sep 7, 2017

Same thing here.

Laravel Mix: 1.4.2 Node: 6.11.1 NPM: 3.10.10 OS: Linux (Elementary OS Loki) + Homestead (3.0)

Even with default configuration.

mix.browserSync({
    proxy: 'demo.local',
    open: false,
    files: [
        'app/**/*.php',
        'resources/views/**/*.php',
        'public/js/**/*.js',
        'public/css/**/*.css'
    ]
});

UPDATE A working example.

mix.browserSync({
    host: '192.168.10.10',
    proxy: 'admix.local',
    open: false,
    files: [
        'app/**/*.php',
        'resources/views/**/*.php',
        'packages/mixdinternet/frontend/src/**/*.php',
        'public/js/**/*.js',
        'public/css/**/*.css'
    ],
    watchOptions: {
        usePolling: true,
        interval: 500
    }
});

source: https://github.com/JeffreyWay/laravel-mix/issues/780#issuecomment-299685750

0reactions
betapixelcommented, May 4, 2019

Excelente solución. Muchas gracias.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Homestead + BrowserSync doesn't watch view files · Issue #950
When using the command "npm run watch" or "npm run watch-poll" to update view files, the screen is not reloaded. However for CSS...
Read more >
Laravel Homestead with BrowserSync - Stack Overflow
My app is homestead.app. So, after starting gulp watch, I go to homestead.app:3000 and see my app without BrowserSync. I go to homestead.app: ......
Read more >
How to configure Browser Sync live reloading in your ... - Teklog
Head over to your IDE editor, change something in your Blade template, Javascript or CSS files and save it. Make sure it's also...
Read more >
Homestead and Browsersync (gulp file) - Laracasts
Hi, I'm trying to integrate BrowserSync into my gulp file, but for the time being it doesn't seem to be working inside the...
Read more >
One Setup to Rule Them All: Vagrant + Laravel Mix + ...
Browsersync will watch those files for changes and reload the browser. So this should be an array of compiled files and templates.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found