Fork me on GitHub
#clojurescript
<
2015-09-18
>
danielcompton00:09:54

@bhauman: If I wanted to make a patch to invalidate compiled files when deps change or other similar issues, whose court would that ball be in? Leiningen, Cljs compiler, or figwheel?

bhauman00:09:46

@danielcompton: this falls squarely on the compiler. But this is something that is being worked on as far as I know.

bhauman00:09:26

@afhammad: it sounds like you need someone who has om-tools experience,

danielcompton00:09:59

@afhammad: I’ve seen those kinds of errors when I’ve reloaded a page halfway through a figwheel recompile, not sure if that’s the case here

afhammad00:09:08

@bhauman: only happens when using figwheel,

bhauman00:09:22

@afhammad: have you looked at the generated js? Turning source maps off and see what's actually being generated could help. My guess given the limited info is Figwheel is reloading file and the browser is choking on the generated js

bhauman00:09:10

@afhammad: what ide are you using? Are you using auto save?

afhammad00:09:29

@bhauman: ok trying. btw is "notifying browser that file changed: ..” the last thing fighweel outputs?

afhammad00:09:42

@bhauman: using Atom, saving manually

bhauman00:09:58

Yes that's the last thing. There should be one line for every file

danielgrosse07:09:53

@bhauman: when I get an Java exception in the Figwheel REPL, the whole REPL has to be restarted. Is this the normal behaviour?

lancefalcon08:09:16

I'm using re-frame for a project and I'm having a bit of trouble as to how I should store the data and what the subscriptions should look like. Can someone help me out?

profil08:09:29

@lancefalcon: There is a #C073DKH9P channel, state you questions there simple_smile

lancefalcon08:09:44

@profil: alright, thanks! simple_smile

borkdude11:09:19

nice feature for chrome would be, if content-type of response is application/edn, have a tree like inspector like we have with json

bhauman12:09:36

@danielgrosse: that is a bug that's fixed in 0.4.0

bensu13:09:07

how does one invite new users? for example <mailto:[email protected]|[email protected]>

dnolen13:09:40

@bensu I didn’t think you needed an invite? just goto http://clojurians.net

martinklepsch14:09:09

Hi @vikeri! Nice meeting you two :)

abtv15:09:37

!Build problem! I've started to use Reagent and can't start my web app with an advanced mode optimization - my page is blank, there are no error messages in console. But if I use a whitespace mode optimization it's OK. I think the problem in minification, but I don't understand where to start. Could someone help me?

martinklepsch15:09:10

Any warnings during compilation? @abtv

martinklepsch15:09:45

Also try adding a top level log statement

abtv15:09:07

@martinklepsch: Yes, you are right. I made lein do clean, cljsbuild once

abtv15:09:21

and received ERROR: JSC_INVALID_CLOSURE_CALL_ERROR. Closure dependency methods(goog.provide, goog.require, etc) must be called at file scope. at /Users/andrew/work/blog/resources/public/js/out/figwheel/client/file_reloading.js line 979 : 7

bhauman15:09:58

You shouldn't be including figwheel in advanced optimization mode.

abtv15:09:26

OK. Could you give some example of such config file with several build settings (dev/production)? I can remove figweel from project.clj, but I think it's a bad way.

bhauman15:09:28

You need to remove it from the build not the project.

bhauman15:09:18

So if you are requiring it in your build you need to not require it @abtv

abtv15:09:53

I see. I have :profiles -> :dev section and there is :figwheel {:http-server-root "public" :server-port 3449 :nrepl-port 7002 :css-dirs ["resources/public/css"] :ring-handler blog.handler/app}

abtv15:09:05

@bhauman: Do you mean this?

bhauman15:09:44

No I mean in your :cljsbuild section for the prod build.

bhauman15:09:29

@abtv: it's hard to know what you env is. I would need to know more about your setup.

abtv15:09:07

@bhauman: build works as a trigger on lein uberjar, but I still can't understand what to remove

bhauman15:09:30

@abtv: so the problem is that you are sharing the same directories between dev and prod. This is a bad idea.

bhauman15:09:52

You should also always clean before you compile to prod.

bhauman15:09:05

it's just a good thing to do.

bhauman15:09:40

but having a different :ouput-dir for dev and prod is an important thing to do.

bhauman15:09:22

I really don't recommend using profile merging to overload a single build config. better to have explicit build configs.

bhauman15:09:40

a :dev and a :prod config

abtv15:09:10

@bhauman: should I have 2 profiles and 1 build?

bhauman15:09:56

You should have two builds and as many profiles as you need. But make sure that you have separate :output-dir for each build

abtv15:09:36

@bhauman: OK, thanks a lot!

bhauman15:09:57

and always clean before doing a final prod build

abtv15:09:42

do you mean lein clean or something else?

bhauman15:09:59

@abtv: btw you can do a prod build within the figwheel repl (clean-builds) (build-once prod)

bhauman15:09:45

@abtv: lein clean as long as it is setup to delete all your compiled assets

bhauman16:09:39

@dnolen: depending on the size of the job cursors are pretty awesome, the contextual update is sweet as heck. I think there is a size correlation to these strategies really small -> single-atom passed around small, medium -> cursors help tremendously freaking huge ... anticipating unbounded growth -> relay, falcor

shaun-mahood16:09:49

@bhauman: Running into an issue using figwheel 0.4.0 with NRepl - following instructions from Github, works in 0.3.9 but in 0.4.0 get the message

cljs.user=> DEBUG: unknown status need-input

shaun-mahood16:09:51

Also doesn't print any response when evaluating an expression

bhauman16:09:59

@shaun-mahood: you should read the changelog simple_smile And we should update the wiki

shaun-mahood16:09:39

Oh no, I'll do that again - read the changelog earlier but didn't think to reread it

shaun-mahood16:09:06

I always end up reading changelogs and only remembering the new stuff, not what I actually need to know

bhauman16:09:14

@shaun-mahood: you need to include piggieback manually now. You'll see

shaun-mahood16:09:02

@bhauman: Ok, threw [com.cemerick/piggieback "0.2.1"] into my dependencies, getting the message

Started Figwheel autobuilder
WARNING: unable to load "cemerick.piggieback/wrap-cljs-repl" middleware
when running lein figwheel, and after running (cljs-repl) it gives me the message INFO: nREPL connection found but unable to load piggieback. Starting default REPL.

bhauman16:09:16

did you put it into the :figwheel { :nrepl-middleware ["cemerick.piggieback/wrap-cljs-repl"] }

shaun-mahood16:09:41

I just added that, no luck though - get the same error messages.

jaen16:09:33

@dnolen: what's the rationale behind the compiler taking a Closure lib from :libs and putting the contents of that dir relative to :output-dir (which would result same-named in files like index.js colliding)? Is it just an arbitrary decision or would anything break if I put files in a subdirectory? I mean, it compiles fine if I do that, but maybe something I'm not aware of will subtly break. (yes, still playing around with putting lib conversion in the compiler, want to have a more solid understanding of how things work before I bother Maria for her opinion)

dnolen16:09:51

@jaen it’s just preserve the directory structure to avoid simple clashing

bhauman16:09:06

@shaun-mahood: it sounds like the dependency isn't available. So connect the nREPL as you normally would, don't call (cljs-repl) and try to (require 'cemerick.piggieback) and see what happens. If piggieback isn't available you need to get that working. Thats outside of figwheels scope

jaen16:09:33

@dnolen: so I can nest that in another directory and expect nothing to break, yes?

dnolen16:09:59

@jaen I don’t understand what you are trying to describe. Can you clarify?

shaun-mahood16:09:48

@bhauman: Yeah, I must be doing something wrong with incuding piggieback. If I can figure it out I'll update the wiki with what is needed for 0.4.0

bhauman16:09:30

@shaun-mahood: try adding it to the :dev profiles :dependencies and are you on lein 2.5.2?

shaun-mahood16:09:43

@bhauman: Still on Lein 2.5.1, so maybe that's the problem.

bhauman17:09:59

yep that might be it

bhauman17:09:10

I mean thanks for offering to update the wiki, I'd really appreciate it

bhauman17:09:25

thats if you get up and running

bhauman17:09:02

I still don't use nREPL. I'm inf-clojure all the way and I'm "cursive curious"

shaun-mahood17:09:36

@bhauman: Looks like it works now, just had to follow the instructions from the piggieback page - adding the :dev profiles part from there worked with Lein 2.5.1.

shaun-mahood17:09:11

Did get a message DEBUG: unknown response keys :printed-value after it printed the response in the cljs repl, though - anything I should look into there?

shaun-mahood17:09:54

@bhauman: I'm using nREPL with Cursive, but am inf-clojure curious - going to have to get the cursive repl working too though

bhauman17:09:43

@shaun-mahood: I have no idea what that is about.

bhauman17:09:48

we verified that it works yesterday

shaun-mahood17:09:31

@bhauman: Yeah, I'm planning on migrating to it at some point - figured I'd get this working so other people who are using nREPL but not cursive can use it too

bhauman17:09:11

gotcha, you actually work with other people ..... I keep forgetting about that

bhauman17:09:43

I'm just a loner

shaun-mahood17:09:00

@bhauman: Nope, only me here - pretty wonderful, I get to pick the language and tools and get paid for it. Just want everyone to be able to use figwheel

bhauman17:09:24

oh I gotcha, thats awesome

jaen17:09:40

@dnolen: basically, if I have somedir/library1 and somedir/library2 specified in :libs then lib-rel-path will treat that as lib-path and strip it from the path of each file in the given library, which will result in somedir/library1/samename.js and somedir/library2/samename.js colliding in out-dir, since both will get out/index.js output path assigned. What I was asking if there's anything in the compiler that depends on this behaviour or if I can safely add a directory to that, so they will result in different paths like out/library1/index.js and out/library2/index.js. To my understanding of the compiler this shouldn't be a problem since load-library basically globs the dir and then resolves module names and dependencies by parsing the ns macro, but I'm all fresh to this, so I want to make sure.

dnolen17:09:27

@jaen if that’s the current behavior I would consider that a bug

dnolen17:09:34

also nothing anyone should ever depend on

dnolen17:09:56

but I also don’t see how they could depend on it, people don’t generally care about the contents of output-dir

dnolen17:09:04

deps.js is what resolves everything anyway

jaen17:09:16

I don't mean people, I mean other code in the compiler (current implementation of module conversion puts the files in out-dir and then adds them to :libs and I follow that so far, which results in files being put in the root of out-dir) - my understanding of it is it doesn't care about directory structure (since it just globs the lib-path), but wanted to make sure.

jaen17:09:43

As you can see it snips the path up to and including the lib-path.

jaen17:09:04

Unless you should not be giving the library root directory to :libs but the parent directory and I'm doing it wrong.

shaun-mahood17:09:47

@bhauman: Looks like the debug message is something weird from having cider-nrepl in my lein profile from long ago - so super out of scope and not related to anything important. Probably safe to say that everything works with lein 2.5.1, too. I also managed to get it to work without adding :nrepl-middleware to my figwheel config. Wiki is updated with what worked for me.

bhauman17:09:15

@shaun-mahood: it should work without :repl-options middleware as well

dnolen18:09:23

@jaen it should preserve the whole path

curtosis19:09:57

argh. I'm going crazy running in circles on this. I simply cannot figure out why lein uberjar is building in dev mode and including all the public/js/out/goog files:

:profiles
  {:uberjar [:profiles/production
             {:omit-source true
             :env {:production true}
             :hooks [leiningen.resource
                     leiningen.cljsbuild]
             :cljsbuild {:jar true
                         :builds
                              {:app
                               {:source-paths ["env/prod/cljs"]
                                :compiler {:optimizations :advanced :pretty-print false}}}}
             
             :aot :all}]}

curtosis19:09:40

It's not picking up the additional :source-paths entry: Compiling "resources/public/js/app.js" from ["src-cljs"]...

curtosis19:09:27

there must be something stupid I'm missing from staring at it too long.

bhauman19:09:44

@curtosis: why not just make an explicit :prod build and for goodness sake make a different :output-dir for your prod build

curtosis19:09:44

I did see your earlier exhortations to different :output-dirs simple_smile

bhauman19:09:20

@curtosis: its not that surprising that the env merge fails on vectors eh?

bhauman19:09:33

@curtosis: that being said deep env merge does seem to fail a bunch

curtosis19:09:37

@bhauman: it was surprising; I was aiming for composite profiles, though I think I was doing it badly.

curtosis19:09:04

@bhauman: when you say add a :prod build, you mean in the :cljsbuild.builds map? parallel to :app?

bhauman19:09:46

more seperate builds and directories, less chance of having files that you don't want included in your build

curtosis19:09:50

and then in (say) my :uberjar profile, the :cljsbuild.builds map would also reference :prod instead of :app, right? just checking to make sure I'm following.

curtosis19:09:19

(I keep also reminding myself when I get lost what sbt was like....)

bhauman20:09:26

@curtosis: yeah I guess, I have never used uberjar

bhauman20:09:16

but I'm assuming that it you are calling cljsbuild once, you will need to make sure that cljsbuild is being called with prod

curtosis20:09:42

@bhauman: yeah, that's where I need to dig. declaring it in the :uberjar.cljsbuild.builds map doesn't necessarily mean it's getting invoked.

curtosis20:09:51

It may, but I'm not confident of that yet.

bhauman20:09:21

You were calling it by hand right?

curtosis20:09:08

sometimes. simple_smile It shows up in the output when I run lein uberjar.

curtosis20:09:02

(sometimes = I've tried adding that step in my dance to try and figure out what's building which way.)

curtosis20:09:12

repeatability is my current bugbear.

curtosis20:09:21

which is not helped by the fact that I have to ultimately build an uberwar, which also has its own profile merging issues.

curtosis20:09:00

OTOH, just for balance, man do I love figwheel. simple_smile

bhauman20:09:15

Actually I think it s the :jar keyword that picks the uberjar build eh?

bhauman20:09:23

thanks man

curtosis20:09:59

showed it to a couple colleagues today and they looked at me like it was sorcery.

curtosis20:09:03

hmmm... :jar in my project.clj just says true for the :uberjar profile.

bhauman20:09:22

I have no idea, it was a guess

bhauman20:09:33

probably shouldn't have ventured that

curtosis20:09:49

hehe... it's voodoo still as far as I can tell.

bhauman20:09:52

yeah the more I look at the chestnut config the more confused I am

curtosis20:09:48

ah well. clearly I'm not pushing a new build to prod at 4:30 on a Friday.

curtosis20:09:21

not when I don't admin the tomcat server, anyway.

bhauman20:09:57

@curtosis: man thats how all of my best weekends started

curtosis20:09:33

the only image macro I throw around.

timgilbert21:09:13

Hmm, looks like stuartsierra/component supports ClojureScript as of an hour ago or so: https://github.com/stuartsierra/component/blob/master/CHANGES.md