Clojurescript works in dev but not production

When ClojureScript is compiled with advanced optimizations, functions will be renamed to short names like the one in your error. When running locally, optimizations are typically off.

This can cause errors when you interface with third party code. If you’re trying to call out to functions in d3, but use d3 with “just a link in the HTML”, you might get a rename that breaks your code.

  • Are you using d3.js from CLJSJS (which should handle the issues above) or some other way?
  • Are you compiling with advanced optimizations?

I don’t have a bunch of experience with this, but you could do a lot worse than starting with the Shadow CLJS Manual chapters JavaScript Integration and Generating Production Code.

1 Like