1

I am trying to use figwheel in my ClojureScript build.

It works with lein cljsbuild auto already, but I have to put :optimisations :whitespace.

Otherwise I get a message in the browser :

Uncaught ReferenceError: goog is not defined

However figwheel require :optimisations :none to run. Here is the part of my leiningen file :

:cljsbuild {
          :builds
          [{:id "dev"
            :source-paths ["src/cljs"]

            :figwheel { :websocket-host "localhost"
                       ;;:on-jsload "example.core/fig-reload"
                       :autoload true
                       :heads-up-display true
                       :load-warninged-code true
                       ;;:url-rewriter "example.core/fig-url-rewrite"
                       }

            :compiler {;; :main
                       :output-to  "resources/public/js/gdb/gdb.js"
                       :output-dir "resources/public/js/gdb/cljsbuild-dev"
                       ;;:asset-path "js/out"

                       :optimizations :none
                       :source-map "resources/public/js/gdb/gdb.js.map"
                       :pretty-print true}}]}

What is missing for me to get the missing dependencies ?

nha
  • 17,623
  • 13
  • 87
  • 133

2 Answers2

6

It turns out this is a classic case of RTFM. The answer was in the ClojureScript quickstart guide.

Specifically, I had to add a :main field, as specified in the Less Boilerplate section :

:main "example.core"
nha
  • 17,623
  • 13
  • 87
  • 133
  • 2
    FYI: This single comment saved me about 5 hours of suffering. Thanks x 10 for putting it up even after you had already solved the problem. – George Feb 15 '16 at 23:43
1

Nothing jumps out as being obviously wrong or missing. However, lein is pretty powerful in the degree it lets you set things to fit your personal taste/workflow, so it is hard to spot things if the approach is signficantly different.

When I run into these types of problems, I find using the standard templates provided by many libraries or projects really useful. My recommendation would be to run

lein new figwheel ft -- --reagent

This will setup a basic project called ft (in this case also with reagent - there is another option for om or you could leave all of this out for a bare bones default. See the figwheel repo on github for more details. This will provide a good working lein figwheel setup which hyou can use as a guide.

Tim X
  • 4,158
  • 1
  • 20
  • 26