Laravel elixir "gulp watch" does not follow changes in Javascript

I am trying to use laravel elixir and it works fine.

gulpfile.js

const elixir = require('laravel-elixir'); require('laravel-elixir-vue-2'); elixir(mix => { mix.sass('app.scss') .webpack('app.js'); }); 

But when I use gulp watch , it only watches scss files, not JS , so if I edit app.js gulp it just doesnโ€™t compile it, however, if I run gulp it compiles all of it just gulp watch , which is not will work properly.

+6
source share
1 answer

There may be (but not sure) a problem with webpack .

So try a different binding method.

For example, try this workaround:

 elixir(function(mix) { mix.scripts(['app.js'], 'public/js/app.js'); .sass('app.scss'); }); 

Also check the terminal for what it displays, maybe some error occurred when it tries to link the app.js file.

If this does not work, let's discuss it in the comments, because your problem requires observer debugging, if it receives an event that indicates a file change or not, and so on ...

perhaps the OS prevents modification time modification.

there can be many reasons that prevent this


final recommendation:

You have to debug "watch" task in gulp and check if it getting file change event or not. So if NOT - write just Your own task that will check changes and run webpack.

+3
source

Source: https://habr.com/ru/post/1012225/


All Articles