Fork me on GitHub
#lein-figwheel
<
2016-08-25
>
ag18:08:48

eh… sorry for maybe somewhat noob question. I am running figweel through sidecar feeding this config into it:

(def figwheel-config
  {:figwheel-options {:server-port 3333
                      :css-dirs ["resources/public"]
                      :ring-handler ‘my-app.server/app}
   :build-ids ["dev" "devcards"]
   :all-builds
   [{:id "dev"
     :figwheel true
     :source-paths ["src"]
     :compiler {:main “my-app.app"
                :asset-path "/js/out"
                :output-to "resources/public/js/main.js"
                :output-dir "resources/public/js/out"
                :parallel-build true
                :source-map-timestamp true
                :verbose true}}

    {:id "devcards"
     :figwheel {:devcards true}
     :source-paths ["src"]
     :compiler {:main           “my-app.devcards"
                :asset-path     "js/devcards_out"
                :output-to      "resources/public/js/devcards.js"
                :output-dir     "resources/public/js/devcards_out"
                :parallel-build true
                :source-map-timestamp true
                :verbose        true}}]})
something doesn’t feel right about this, and indeed sometimes it doesn’t work as intended. Can I have devcards as part of my “main” build profile?

bhauman20:08:11

this is how its done, what isn't working?

ag21:08:18

when you have multiple build targets, sometimes cljs repl doesn’t seem to respond.

ag21:08:44

in the main app. but if you navigate to /devcards/ route - it works

bhauman22:08:00

A REPL is attached to a single build only. It tells you which build when it launches.

ag22:08:12

ok… something prob. wrong with my setup here, I’ll investigate. Thanks!

shaun-mahood22:08:09

@ag: Might be a dumb question, but does it only happen when you've just started figwheel?

ag22:08:42

it’s strange, cljs repl won’t respond on the main “dev” profile, unless I remove “devcards” profile from build-ids

ag22:08:52

but it works in devcards

bhauman22:08:52

when you run cljs-repl you just need to pass it the build id that you want the repl to start in

bhauman22:08:06

(cljs-repl :dev)

bhauman22:08:16

or (cljs-repl :devcards)

ag22:08:34

oh… ok… got it now

ag22:08:09

it still not working it gets stuck at "Prompt will show when Figwheel connects to your application"

bhauman22:08:58

@ag when the repl launches what build is it saying its going to connect to?

bhauman22:08:08

it should say something like "Launching ClojureScript REPL for build: example"

darwin22:08:08

@bhauman: just upgraded to 0.5.6, now I hit another issue, figwheel is newly reporting "All ClojureScript build config :output-dir parameters should be unique” where :output-dir is clearly unique for all my build ids

bhauman22:08:20

@darwin: is there any way that the profile merging could be duplicating builds?

darwin22:08:44

good point, let me investigate it

bhauman23:08:27

@darwin: lein-pprint can help with this

bhauman23:08:40

in case you didn't know

darwin23:08:27

yes, something fishy is going on there, that pprint is huge, but it looks like resulting EDN contains all profiles and final merged profile and that could be confusing figwheel (theory)

ag23:08:08

@bhauman oh I see, it’s always says the same thing:

(ra/cljs-repl :dev)
Launching ClojureScript REPL for build: devcards

bhauman23:08:17

OK hmmm well that's not working

ag23:08:03

do I have to have ids in strings or they have to be keywords?

bhauman23:08:29

oh yeah a string might do it

bhauman23:08:41

this functionality isn't used that often

ag23:08:04

gimme a sec, I restarted the repl, gonna try (ra/cljs-repl “dev”)

darwin23:08:30

ok, found the issue, it is not really figwheel’s fault, but the error message is confusing

ag23:08:43

Yay! it worked!

darwin23:08:47

I’m using this technique to enable/disable checkouts: https://github.com/binaryage/dirac/blob/master/project.clj#L347

ag23:08:51

@bhauman you’re awesome!

darwin23:08:00

and that leads to empty :compiler {} maps

darwin23:08:23

so all degenerated build-ids have nil :output-dir

bhauman23:08:54

which is technically the same output dir

bhauman23:08:28

this is also required by cljsbuild

bhauman23:08:01

ah but that is a different profile

darwin23:08:26

I used this technique to avoid combinatorial explosion in my profiles, there does not seem to be a good way how to disable checkouts directory (for example for release testing)

darwin23:08:30

will find a way around it

bhauman23:08:43

man that sucks

bhauman23:08:07

I should have enforced this from day one...

bhauman23:08:21

@ag Thanks! Sorry for the trouble.

bhauman23:08:51

I didn't have a good validation framework to do it with.

ag23:08:29

You kidding me? Figwheel is awesome! One of the reasons why I quit my boring angularjsque work is due to figwheel. I bet my career on it and I am extremely happy!

bhauman23:08:50

oh yeah that's what I like to hear

ag23:08:06

I did not know CLJS. Trying figwheel was like a revelation. Now I know - Clojurescript is better than javascript to build javascript apps

bhauman23:08:19

You are one of the few. Thanks!