This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-16
Channels
- # admin-announcements (27)
- # beginners (17)
- # boot (216)
- # cider (13)
- # cljs-dev (4)
- # clojure (103)
- # clojure-berlin (2)
- # clojure-dev (18)
- # clojure-italy (14)
- # clojure-japan (1)
- # clojure-nl (4)
- # clojure-norway (1)
- # clojure-russia (8)
- # clojurescript (291)
- # clojurex (12)
- # datomic (31)
- # editors (1)
- # events (16)
- # hoplon (60)
- # jobs (1)
- # ldnclj (85)
- # luminus (15)
- # onyx (2)
- # re-frame (18)
- # reagent (36)
- # remote-jobs (3)
- # yada (3)
@pandeiro: This exists—it appears to directly drive a little React from ClojureScript (no Om or Reagent, etc.). https://github.com/nicholaskariniemi/ReactNativeCljs
hello all, may i please have your suggestions of methods/frameworks for mobile html5 cross platform development in clojure(script) ? very much appreciated. thank you
@jouerose: I'd take a look at this - https://github.com/enterlab/cordevicljs
@jouerorse: the example uses OnsenUI, but there's a lot of mobile HTML frameworks you may want to use in cojunction with Phonegap - Ionic, Sencha Touch, Touchstone, Reapp, material-ui; the last three mentioned are React-based so may be the most interesting to you. There's probably a lot more you can find through Google.
hi @dnolen , i researched programming languages over the past few months, and clojure(script) looks like a dream language. today i am wondering what are the ways to do cross platform mobile development with it, therefore my question in reality is beyond ionic. if you know anything, thanks for letting me know.
@jouerose: there’s a good chunk of the ClojureScript community that’s focusing their energies on React as React is immutable friendly
@dnolen is there anything for React Native ? would you know whether React (non Native) is an option with clojurescript when targetting mobile ?
@jouerose: people are already using React Native, and also working actively to enhance it’s usage via ClojureScript
you can of course approach mobile via more “webby” tech and I know people are doing that too.
@dnolen thanks. would you any keyword/reference for the mix of clojurescript and react native ? any project or example ?
@jouerose: there are some things but your patience level is going to have to be very high, literally every aspect of this of kind of development is cutting edge
and you’ll have to have some working knowledge of Clojure, ClojureScript, Objective-C, iOS, React
@dnolen: i am beginner level in clojure(script) but willing to still have a look at the keywords and references you can drop. if i must wait before using the perfect score, i will take something meanwhile while keeping an eye on the cutting edge
I’m not aware of anything else or anything easier to get started with. There be dragons.
@dnolen: regarding natal, i have seen in clojure world that sometimes while version number is low, it can be considered production ready. is Natal one of those software ?
well, you have the fundamental instruction stuff here https://github.com/omcljs/ambly/wiki/ClojureScript-React-Native-Quick-Start
@jouerose: cutting edge and “production ready” are generally not said in the same breath
This may be attempting rocket surgery on a moving rocket, but is there any way to open a REPL up in the ClojureScript compiler while it’s running from Figwheel?
I’m trying to track down a very sporadic bug, and wanting to get more visibility into what’s going on in the compiler
@danielcompton: the easiest way to do this today is to use Cursive, won’t give you a REPL but that will give you a debugger with in-frame eval which is probably more useful anyhow for this
I’ve got Cursive running, but I’m guessing I need to start with a debug config?
Took a few days for this bug to show up again, so I don’t really want to kill the REPL 😞
Can I do this from figwheel, or do I need to launch the compiler directly?
Got the debugger attached with breakpoints in ClojureScript, off to bed now!
Thanks @dnolen, I appreciate the help
@danielcompton: np the more people know how to do this the better
@maria: @jaen: this is interesting http://blog.persistent.info/2015/05/teaching-closure-compiler-about-react.html
looks like somebody may have already written all the integration bits we would need, open question as to how reusable it is or simple to integrate
@dnolen: interesting. Though if I understand that correctly it's React-specific, so it does not solve the general module problem, just eases integration with React in an already browserify-processed form.
@jaen yeah sorry wasn’t talking about the module issues, just using this for JSX processing instead
@dnolen: hmm, this seems suggest they do JSX beforehand though - https://github.com/mihaip/react-closure-compiler/blob/3317cbef681b943c1854a492d5035ccd32bf7073/demo/index.js#L26-L27
Is cljs.nodejs suppose to come with ClojureScript? I can’t locate it.
Oh, nevermind… for some reason my non-nodejs build is picking up a directory I’m not specifying, which contains nodejs code.
Any ideas why I’m getting this error: lojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/nodejs__init.class or cljs/nodejs.clj on classpath., compiling:(projectx/node.clj:1:1)
Thanks @dnolen.
And now this: SEVERE: cljs.nodejs:1: ERROR - namespace "cljs.nodejs" cannot be provided twice
I’m feeling stupid today.
Yes, I get that bit, but I can’t identify why?
No, I’m not doing that.
mhh… would src/cljs also include ser/cljs-node in cljsbuild?
No, that’s not it 😕
Yes, I’m watching it run right now.
wow, compiling each of my targets individually work, but all together fails.
also resources
probably should NOT be on your classpath for compilation unless you want very confusing bugs
yup, I am sharing output dirs… but that doesn’t make sense anyway.
compiling to the same output dirs is a surefire way to create problems if you’re not careful
No, I mean, for my project, these two outputs shouldn’t be in the same directory, it makes sense to separate them.
I still seem to get the same error… let me try to reproduce it cleanly.
I do have a resources
After properly cleaning the project, it seems to be working.
Thank you @dnolen
ok… the error happens when I’m recompiling and I didn’t clean it first. :S
@dnolen: I didn’t do that explicitly and the nodejs code now outputs outside resources… it outputs to target… which is probably bad too 😕
if you do this then the compiler will look there for ClojureScript and JavaScript files
Yes, I understood that, but I don’t see how resources can end up in the classpath.
oh! so, the default lein behaviour is bad?
lein gets that behavior (probably) from maven, which does the same
How do I undo it then?
:resource-paths
close @dnolen 😜
but is it valid inside cljsbuild? and what does it normally contain so that I remove resources and leave the rest?
you can set it in profiles https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L160
I believe it is :resource-paths ["resources"]
by default
but you can always read the source to find out for yourself
bostonaholic: that would require having different profiles for clojure and clojurescript, so instead of dev, now I would need to have dev-clj and dev-cljs.
Anyway, having :resource-paths [] didn’t fix the problem.
@pupeno: I’m very skeptical about that claim. Paste what you tried. And no :resource-paths
doesn’t go in :cljsbuild
it’s a Lein thing.
dnolen: here it is: https://gist.github.com/pupeno/70eff5d4629f79874233
@pupeno: I doubt supplying an empty :resource-paths
will work, you need to supply something
https://gist.github.com/pupeno/70eff5d4629f79874233 (I passed “foo”), still happening.
Figwheel-reloadable local state in Reagent: http://vvvvalvalval.github.io/posts/2015-09-16-bottup-approach-to-reagent-state.html
Feedback appreciated
dnolen: my output dir is resources/public/js for one of my builds, target/js for the other (following your recommendation of not having them in the same directory). There’s no resources/cljs directory.
I set it to something different before and I think it was still happening, let me check.
you can keep checking. But the principle is this - if the ClojureScript compiler sees a namespace called cljs.nodejs
it will attempt to find on the classpath in a non-deterministic way
that is cljs.nodejs
should only resolve to what’s in the ClojureScript JAR nothing else
dnolen: I understand that, but I don’t see why a secondary cljs.nodejs is appearing.
I set the output directory to foo2
and it’s still happening.
@pupeno if you understand what I said, then it should be obvious how a second one can appear
if you don’t understand how it can appear twice, then you did not understand what I said above
Ok, then I didn’t understand it.
Clearly it’s picking up an extra file: https://gist.github.com/pupeno/70eff5d4629f79874233#file-when-it-doesn-t-work-L8 when it fails (13 sources instead of 12).
Yes, but I don’t understand why 3 is happening.
3) is happening because something is setting :nodejs
target or explicitly requiring that ns
dnolen: yes, I am setting :nodejs because I want to run my app in :nodejs and I’m requiring cljs.nodejs so that I can call (cljs.nodejs/enable-util-print!)
the solution is tweak your classpath so the same resource can’t be resolved twice when you compile
How do I remove foo2//server-side/cljs/ from the classpath then?
(and why is cljsbuild putting node.js there when it breaks things?)
And why isn’t foo2//server-side/cljs/core.js a problem but foo2//server-side/cljs/nodejs.js is? or is nodejs.js just failing first?
if I were you I would whittle this down to a minimal case to determine if it’s a bug in cljsbuild or something we’ve missed
Ok, it wasn’t that obvious and simple after all.
I’ll try to make a minimum case, although this is already quite a minimum case from what I’m trying to do.
Yes, there are two nodejs.js, that’s simple, it’s in the error message, but why they are or how to avoid it is not simple. All cljs gets compiled to js files there, so it doesn’t feel like it’s wrong.
What decision is polluting the classpath?
what do you mean?
I don’t use any of these tools because I want to know that the classpath isn’t going to include some random stuff for whatever operation I intend to do
Using lein and cljsbuild is my mistake?
@pupeno: no, but you should understand the opaqueness of what’s going to be on the classpath is a direct result of what you decided to use
so if you want to use these things you will have to sort out how they work wrt. the classpath
https://gist.github.com/pupeno/70eff5d4629f79874233 there’s the classpath, it doesn’t include foo2//server-side/cljs/nodejs.js
So that’s not the problem.
I don’t see how that CLASSPATH would include cljs/nodejs.js twice.
have you tried to do recursive directory search to see how many times cljs/nodejs.js
occurs in your project?
$ find . -name nodejs.js ./foo2/server-side/cljs/nodejs.js ./foo2/server-side/goog/bootstrap/nodejs.js
dnolen: not according to lein classpath: https://gist.github.com/pupeno/70eff5d4629f79874233
@pupeno: don’t you need to run a different command to compute the classpath for a profile?
I thought the :dev profile was the default.
If nodejs.js is a problem there, then core.js should be a problem here ./resources/public/js/app/cljs/core.js and the app should fail with the same error.
$ grep -R "goog.provide('cljs.nodejs')" target/ target//js/server-side/cljs/nodejs.js:goog.provide('cljs.nodejs'); target//js/server-side/D2E353E.js:goog.provide('cljs.nodejs');
WTF is D2E353E.js?
right so this right back to the problem of sharing output directories and putting them on the classpath
No, it’s not.
It’s not in either of them.
:source-paths ["src/cljs" "src/cljc" "src/node"]
I’m not saying it does, but I’m not explicitly doing that.
@pupeno what happens if you remove the :scope “provided”
bit from your ClojureScript dep?
I don’t have :scope “provided"
@pupeno: you do https://gist.github.com/pupeno/70eff5d4629f79874233#file-project-clj-L19
Ah, that provided, nevermind, let me try.
If I stop requiring it, the problem stops, but then I can’t call enable-util-print!
dnolen: foo2 was my renamed target to try to avoid collisions.
let me update things so everything is consistent.
target/js is specified as the output dir in project.clj
It does, here: https://gist.github.com/pupeno/70eff5d4629f79874233#file-project-clj-L48
in your case it appears that when you run all builds somehow the :none
compilation artifacts end up in :simple
output-dir
that’s about as far as I’m willing to dig into this, gotta switch gears - this appears to me at the moment that this is firmly in cljsbuild territory
@pupeno and you’re right about your project.clj, it looks fine and doesn’t appear to have any of the issues I mentioned, it’s just that almost every user that reported that bug has always had classpath issues
I suspect that this may be one of those cases people always get tripped up on and just learn to clean and never report the cause 😞
I still don’t see the wrong files in the wrong place. So maybe this is a profile merging thing? dunno
I switched from :simple to :advance optimizations and now it’s finding even more sources to mess up together (still the same error though).
lein ancient claims I’m having the latest one.
upgrading, same, disabling profiles, same 😞
Removing :target :node or removing :require [cljs.node] fixes it.
I tried setting it to foo2 and the behaviour was identical. Before it was set to resources (when the problem started).
@dnolen: ruling out ~/.lein/profiles.clj
is usually one of the first steps I take
@danielcompton: I deleted it, no effect.
Oh, nodejs works with :optimizations :none? I thought it required at least simple. Anyway, it works with :optimizations :none, so the problem is with optimizations.
Anyway, thank you everybody and specially @dnolen for the help, I’m off to sleep.