Alexander Kim
Alexander Kim

Reputation: 18410

Laravel Mix infinite loop when using npm run watch [L5.6]

Here's my webpack.mix.js file:

mix.js('resources/assets/js/app.js', 'public/js')
   .combine(['public/js/app.js', 'node_modules/owl.carousel/dist/owl.carousel.js'], 'public/js/app.js');

I am launching js task, then combining all js files into a single one.

When i run npm run dev everything works as expected, but if i run npm run watch and then edit a file that being required in app.js (custom.js) this way:

require('./bootstrap');
require('./custom.js');

Then save the changes, mix is compiling very long, after it finishes my changes not reflected. Am i doing something wrong there?

Upvotes: 1

Views: 2063

Answers (1)

Alexander Kim
Alexander Kim

Reputation: 18410

Loop issue was because i used the same name when combining js files - app.js.

Correct way is not using combine, i've included my owl carousel file in app.js:

require('owl.carousel');

Upvotes: 1

Related Questions