clojureclojurescriptuberjarfigwheel

Including JS files compiled using Figwheel to Uberjar built


Here is Figwheel config, app.cljs.edn

^{:watch-dirs ["src/cljs" "src/cljc"]}
{:modules
 {:aff {:entries #{asaas.aff.aff}
        :output-to "target/public/js/aff.js"}
  :loc {:entries #{asaas.aff.loc}
        :output-to "target/public/js/loc.js"}  
  :user {:entries #{asaas.user.user}
         :output-to "target/public/js/user.js"}
  :auth {:entries #{asaas.auth.auth}
         :output-to "target/public/js/auth.js"}}
 :output-dir "target/public/js/app"
 :asset-path "/js/app",
 }

The problem is, it just works in dev. How should I go about including compiled JS files in my .jar, created by uberjar?


Solution

  • Modified app.cljs.edn to,

    ^{:watch-dirs ["src/cljs" "src/cljc"]}
    {:modules
     {:aff {:entries #{asaas.aff.aff}}
      :loc {:entries #{asaas.aff.loc}}
      :user {:entries #{asaas.user.user}}
      :auth {:entries #{asaas.auth.auth}}}
    
     :output-dir "resources/public/js/app"
     :asset-path "/js/app"}
    

    Now it's getting packaged.

    Note: Omission of :output-to is not the key; changing target/ to resources/ did the trick. And please, advise me on the best practices. Thanks.