cljsjs

joy 2017-03-03T11:35:24.001276Z

Hi! I’m using cljsjs for the first time (specifically, the Dragula library: https://github.com/cljsjs/packages/tree/master/dragula). When I compile with :whitespace optimization, everything works as expected. But when I compile with advance compilation, I get the JS error dragula(…).Xb is not a function My cljs setup is minimal in my project.clj:

:cljsbuild
  {:builds
    [{:source-paths ["src-cljs"]
      :jar true
      :compiler {:output-to "resources/public/js/main.js"
                 :optimizations :advanced}}]}
I assume that I am missing some option somewhere. If someone can spot the error quickly, can you let me know?

joy 2017-03-03T11:55:36.001277Z

I think it is actually the click event .on which is translated to Xb

juhoteperi 2017-03-03T12:03:24.001278Z

@joy extern is probably missing something: https://github.com/cljsjs/packages/blob/master/dragula/resources/cljsjs/dragula/common/dragula.ext.js

joy 2017-03-03T12:16:53.001279Z

is there a way to override the extern locally? I think it is missing the ‘on’ function, but I would like to test it out. If so, I could do a pull request.

juhoteperi 2017-03-03T12:17:20.001280Z

yes, you can create local externs

juhoteperi 2017-03-03T12:17:36.001281Z

and either include them with deps.cljs or compiler options :externs

juhoteperi 2017-03-03T12:17:50.001282Z

or, you can clone packages repo, fix the extern there and install jar to local mvn repo