1

We have a project, and 2 builds:

  :cljsbuild {:builds
          [

           {:id "devguidelines"
            :source-paths ["src"]

            :figwheel {:on-jsload "vr.guidelines/on-js-reload"}

            :compiler {:main vr.guidelines
                       :asset-path "js/compiled/out"
                       :output-to "resources/public/js/compiled/vr.guidelines.js"
                       :output-dir "resources/public/js/compiled/out"
                       :source-map-timestamp true}}

           {:id "testguidelines"
            :source-paths ["src" "test"]
            :compiler {:output-to "resources/public/js/test/test.guidelines.js"
                       :output-dir "resources/public/js/test/out"
                       :optimizations :none
                       :main vr.test-runner
                       :asset-path "js/test/out"
                       :source-map true
                       ;; :source-map-timestamp true
                       :cache-analysis true }}

when I start it:

rlwrap lein figwheel devguidelines testguidelines

they both get built however in repl, I get access to testguidelines not devguidelines, which makes repl useless. (Launching ClojureScript REPL for build: testguidelines) How can I configure repl to reload devguidelines not testguidelines ?

Matt
  • 14,906
  • 27
  • 99
  • 149
Dan Bunea
  • 187
  • 1
  • 2
  • 10

2 Answers2

1

I'm not sure it really makes sense to run two cljsbuilds inside figwheel; figwheel compiles the code and serves it to the browser - how would it decide which build to serve? Note that figwheel requires at least one build that has :optimizations :none, which is the default - so both of your builds qualify.

It looks to me like you're trying to run tests whenever figwheel recompiles files. The way to do this is using the :on-jsload hook to trigger a test runner you've written (like your vr.test-runner, for example).

EDIT: you totally can run two builds in the same REPL, try using the switch-to-build figwheel function that gets listed out when you start figwheel. Thanks @user2906524!

Conan
  • 2,288
  • 1
  • 28
  • 42
  • 1
    The idea of starting both came from the "father" of figwheel itself: https://youtu.be/j-kj2qwJa_E?t=26m44s . However you may be right to do something :on-jsload. – Dan Bunea Jan 18 '16 at 07:30
  • Yeah I didn't know that, that's ace! – Conan Jan 27 '16 at 14:29
1

A ClojureScript REPL can only connect to one "build" at a time. If you are auto building two or more builds you can switch the "build", the REPL is connected to by quitting the current REPL. To quit you must by enter :cljs/quit at the prompt.

Figwheel will then ask you if you want to connect a REPL to a different build and will list the choices.

Bruce Hauman
  • 146
  • 1
  • 5