figwheel-main

ChillPillzKillzBillz 2021-07-21T15:36:05.037Z

once you are done with the development... how does one actually release the figwheel build for production? What is the process?

danieroux 2021-07-21T15:42:53.039200Z

Figwheel is a dev-only tool. It sits on top of cljs.main to add dev convience.

danieroux 2021-07-21T15:43:18.039900Z

So the process to build for production is to just use cljs.main. This is how I do it:

danieroux 2021-07-21T15:44:01.040600Z

clojure -M --main cljs.main --compile-opts common.cljs.edn --compile-opts min.cljs.edn --compile-opts prod-server-config.edn --compile

ChillPillzKillzBillz 2021-07-21T16:15:26.041Z

Thanks I'll give it a try

ChillPillzKillzBillz 2021-07-21T16:34:19.041200Z

Is there an example for the contents of all the edn files you are using? Many thanks again

ChillPillzKillzBillz 2021-07-21T16:44:12.043100Z

Ok Figwheel build with dev settings works. When built with advanced setting... however the script doesn't work atall!! Why is this? I merely included the dev-main.js in the html and opened the html in browser... I am sure I am being an idiot... any help will be greatly appreciated.

2021-07-22T13:17:11.043300Z

Javascript interop doesn’t always work very well with advanced compilation. To make it easier to track down, you can add :pseudo-names true to your config. Generally what has happened is that the CLJS compiler has renamed some interop call, not understanding that it was an interop call. One way to deal with these situations is to typehint the JS object with ^js; however, I have personally run into some kind of small, reproducible bug where this was not entirely reliable. The most reliable method I know of is https://clojurescript.org/reference/dependencies on the cljs website:

(let [yay ((goog.object.get js/window "yayQuery"))]
  ((goog.object.get yay "sayHello") ((goog.object.get yay "getMessage"))))
However, I recommend tweaking this for full generalizability — you https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind bind the fn back to the object you pulled it off of for it to work. Have fun!

👍 1