I had some of the same issues in laravel 5.3 , I now use laravel 5.4 where gulp has been depreciated and uses laravel mix. Works great! just run npm run watch-poll // to run a watcher and npm run dev to run without the watcher.
Gulp Watch Taking forever to recognize changes
Im been having this problem ever since I started developing with laravel and gulp. My project is using the spark boilerplate code (https://spark.laravel.com/). The gulpfile is pretty simple, code below. The problem is that when I run gulp watch, my changes to files are recorded and bundled maybe 4-6 times before it basically stops working.
For example, I make a change to javascript file A. It picks up the change, compiles the bundled file and everything works fine. This works maybe 4-6 times as I mentioned then it stops picking up changes. So when I make the 5th change (for example), gulp might not recognize that I changed the javascript file for minutes or ever. This forces me to rerun gulp watch, which then allows the changes to be picked up again for another 4-6 times.
This problem is really terrible, I can't develop for more than 10 minutes without restarting gulp. I have no idea whats causing the slowness.
gulpfile
elixir(function(mix) {
mix.less('dashboard.less')
.browserify('dashboard.js', null, null, { paths: 'vendor/laravel/spark/resources/assets/js' })
.copy('node_modules/sweetalert/dist/sweetalert.css', 'public/css/sweetalert.css')
.copy('node_modules/trumbowyg/dist/ui/trumbowyg.min.css', 'public/css/trumbowyg.min.css')
.copy('node_modules/trumbowyg/dist/ui/icons.svg', 'public/img/trumbowyg.svg');
});
log
[21:05:25] Using gulpfile c:\xampp5.6\htdocs\[company]\gulpfile.js
[21:05:25] Starting 'watch'...
[21:05:25] Starting 'all'...
[21:05:25] Starting 'less'...
[21:05:28] Finished 'less' after 3.37 s
[21:05:28] Starting 'browserify'...
[21:05:33] Finished 'browserify' after 4.52 s
[21:05:33] Starting 'copy'...
[21:05:33] Finished 'copy' after 19 ms
[21:05:33] Starting 'copy'...
[21:05:33] Finished 'copy' after 7.18 ms
[21:05:33] Starting 'copy'...
[21:05:33] Finished 'copy' after 5.31 ms
[21:05:33] Finished 'all' after 7.93 s
[21:05:33] Starting 'default'...
[21:05:33] Finished 'default' after 8.42 ms
[21:05:33] Finished 'watch' after 7.98 s
[21:05:42] 1803274 bytes written (9.30 seconds)
[21:06:39] 1803012 bytes written (4.40 seconds)
[21:15:05] 1802933 bytes written (4.49 seconds)
[21:24:39] 1803073 bytes written (5.14 seconds)
The last change there is where it started slowing down. It states 5.14 seconds but its not. It took minutes before it even recognized the change, THEN it took 5 seconds to finish the task.
The main js file that is actually being bundled has actually become quite large (63k lines). But most of this is just the boilerplate code from Laravel Spark.
Does anyone else have this problem? What am I doing wrong?
Please or to participate in this conversation.