Hi there people
So I’ve got a web app, that is mostly server-side rendered, and typically uses jquery to faciliate the interactions with the pages. I’ve just added stimulus into the mix, to tidy up some 'orrible unwieldly code and I’m happy with the result!
I’m using gulp currently to build my JS for production. Currently, I get all my JS files, run them through gulp-concact, then run the result through gulp-uglify, to minimize the resulting JS code.
Because I’m not using webpack, I’m adding stimulus from the unpkg source for now, and defining my stimulus controllers as per the guidelines here
Now, when I run that through my gulp pipeline, uglify complains when it encounters a controller:
Error] GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token name «extends», expected punc «,»
So I’m wondering how best to handle this. Should I exclude my stimulus code from being uglified, do I need to run it through something like babel first - I’m very confused because the docs are quite focussed on this being used with webpack - and switching to webpack is a much bigger deal!
Thanks for any advice / recommendations