I know this topic is widely been talked about on here but I cant seem to get it fixed on my end.
My gulp in VS is not working for some reason so I run gulp outside in a terminal window. When I open a fresh branch and run gulp all
, it works fine. I then start gulp watch
which starts fine. Then I go and make the changes to the Javascript I am trying to fix and after I make the change to say JS function and press save, my gulp watch
blows up and says "GulpUglifyError: unable to minify JavaScript"
.
It seems like everything works until I make a change to the actual JS. I am very new to JS so forgive me if this is a noob question but in my mind, I should be able to make a change, then save it in VS and have gulp watch roll along and re-uglify the JS?
Is it the arrow function in my JS that is causing this error es5 vs es6? Is uglify unable to handle this:
setTimeout(() => { $("#from_date").data("DateTimePicker").minDate(e.date); }, 0);
If so, how can I rewrite this function to work with my uglify()?
Turns out I was getting an uglify error because I was trying to uglify an arrow function => which is an es6 feature. Instead I rewrote the function in es5 syntax to get rid of the =>.