Added require and refactored JS to use require: add_requirejs

check!