Laravel-mix: Add folder to watch

Created on 4 Feb 2017  路  8Comments  路  Source: JeffreyWay/laravel-mix

Hi, any idea how I would add other directories to be watched?

Most helpful comment

mix.browserSync({
   files: ['file.js']
});

It does the trick. More info https://browsersync.io/docs/options

it's just reload and not trigger laravel-mix compiling

All 8 comments

You can't right now, unless you copy our webpack.config.js file to your project root, and maintain it yourself.

Any update to this issue? Perhaps using mix.webpackConfig() somehow?

mix.browserSync({
   files: ['file.js']
});

It does the trick. More info https://browsersync.io/docs/options

@tiagomatosweb doing this doesn't rebuild JS/CSS files from sources, nor does it even cause the browser to refresh. I'm watching .env and a SASS variables file that gets symlinked into the SASS build pipeline, and changing either one does nothing.

Mm.. not sure! It was a workaround while ago. Do not remember if it recompile everything once those files set in browserSycn object are updated. Sorry mate.

Is there anything we can do about this? It is clearly still an issue as subfolders are not watched at ALL by npm run watch.

I have managers in resources/js/managers. If I move the files to root, they are watched, but if they are put into the managers subfolder they are completely ignored.

I think the webpack HMR can be used/extended
https://webpack.js.org/guides/hot-module-replacement

mix.browserSync({
   files: ['file.js']
});

It does the trick. More info https://browsersync.io/docs/options

it's just reload and not trigger laravel-mix compiling

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nezaboravi picture nezaboravi  路  3Comments

mstralka picture mstralka  路  3Comments

jpmurray picture jpmurray  路  3Comments

wendt88 picture wendt88  路  3Comments

hasnatbabur picture hasnatbabur  路  3Comments