Fork me on GitHub
#clojurescript
<
2016-04-30
>
brown13100:04:06

I have a naive question. I’ve made an uberjar, but every time I try to run it (java -j myuberjar.jar) it just starts the repl.

brown13100:04:18

I must be missing something...

brown13100:04:03

Am I missing something from the command line when I start it?

brown13100:04:52

This is a clojurescript project, BTW.

darwin00:04:01

I’m not a java guy, but I don’t understand what would you want that uberjar to do in clojurescript context. Are you using leiningen?

darwin00:04:33

in clojure context I understand that uberjar runs your clojure (java) code, but clojurescript is javascript

dimiter00:04:45

Whole point of CLJS is that it compiles into standard ES5 Javascript without the need for Java

brown13100:04:28

Yes. Good point. Thanks.

brown13100:04:06

I think what I really need to know is how to deploy a production build.

brown13100:04:04

I’ve been googling and I can’t find anywhere that tells me what I need to do to package it up.

brown13100:04:17

I assume it needs the html as well as the compile js. Is there a tool for deploying a cljs web site?

brown13100:04:45

(Sorry about the dumb questions. I’m a newbie to clojurescript)

brown13100:04:18

I guess I was thinking that an uberjar was like a war file.

dimiter00:04:17

Essentially, once you compile the code, you should be able to just load it onto any web-server and it should work. Its just javascript.

brown13100:04:04

I see that ring has a uberwar. That may be what I’m looking for.

dimiter00:04:25

Are you writing just Clojurescript code, or do you have a server component too.

brown13100:04:53

Right now just clojure script, but I will have a server component.

mfikes00:04:04

If you’re curious about stats for Replete (iOS ClojureScript REPL), here they are: (That’s right, no crashes!): http://blog.fikesfarm.com/replete-stats.png

lewix01:04:27

What should I pick OM or reagent?

adamkowalski01:04:49

I personally like reagent and reframe because I prefer frp however, om next and rum are both fantastic choices as well. maybe try making a simple app in each and see which one fits your mental model the best?

lewix01:04:31

@adamkowalski: Where can I find good learning ressources about reagent

cigitia02:04:11

Has anyone here been able to successfully use cljsjs/react-dom-server on Node.js? I’m trying it out and am encountering a Node.js module problem: 1. When I compile any CLJS code that uses both cljsjs/react and cljsjs/react-dom-server (versions 15.0.1-1), with CLJS-compiler option {:target :nodejs}, 2. and then run the code in Node.js, 3. when cljs.react.dom.server is required, 4. line 16 of out/react-dom-server.inc.js is run, 5. which causes Node.js to attempt to run require(‘react’), 6. which Node.js then fails to find, throwing the error Error: Cannot find module ‘react’.

cigitia02:04:51

I’m probably missing something here, but I don’t know what.

cigitia02:04:55

The responsible line is the fifth one (when copyright is excluded) in https://github.com/facebook/react/blob/master/vendor/react-dom-server.js#L5.

cigitia02:04:15

I suppose I could put a root-level package.json, with a dependency on react’s NPM package, into my compiler-output folder…but that strikes me as kind of weird and convoluted. What do people who use cljsjs/react-dom-server do?

isaac_cambron17:04:15

I'm trying to get optimizations:none to work in my chrome extension. The trick is to get Closure to load stuff from the right places. The obvious thing to do was to set asset-path to the chrome extension URL, like "chrome-extension//[some-id]". That sort of works in that it finds and loads my cljs_deps file. The problem is that that file looks like:

goog.adddependency("base.js", ['goog'], []);
goog.adddependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.string.stringbuffer', 'goog.array']);
//more stuff
In other words, it seems to assume that cljs_deps is in the goog subdir. Does providing an absolute URL for asset-path just not work, or am I missing something obvious?

mfikes17:04:12

@isaac_cambron: All I can add is that all of the :none environments I’ve worked with end up having to cope with that directory structure.

isaac_cambron17:04:54

Hmm, yeah, it doesn't seem to have anything to do with :asset-path, actually

isaac_cambron18:04:06

I'm not sure how it's supposed to fit together, i guess

mfikes18:04:46

Meaning, I’ve had to specifically add tiny bits of code in each thing to accommodate it. In other words, what you are seeing is a real thing, FWIW. simple_smile

isaac_cambron18:04:02

hmm, ok, thanks

mfikes18:04:44

Here is one small example where goog crops up (they all end up involving something along these lines): https://github.com/omcljs/ambly/blob/master/ObjectiveC/src/ABYContextManager.m#L145

isaac_cambron18:04:43

that's disheartening. i was hoping you'd say "You're just misunderstanding how closure loads code. Do this one obvious thing."

mfikes18:04:58

I think this may be the same… but it has been over a year since I’ve looked at this bit of code: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/repl/node.clj#L124

isaac_cambron18:04:18

yeah, that does look the same

isaac_cambron18:04:22

cool, i'll start there

mfikes18:04:53

It typically involves an extra ”goog” and then things like ”../“ take care of popping back out of it and it all pans out in the end.

isaac_cambron18:04:24

yup, makes sense

isaac_cambron18:04:35

a little confused on why it's like this in the first place, though

isaac_cambron18:04:13

yeah, I must be missing something. The compiler goes out of its way to remove that goog: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1661

darwin18:04:21

@isaac_cambron: not sure what is your exact issue without providing full project.clj - in my sample extension project I didn’t have any issues using leiningen + cljsbuild in both dev and release modes, using relative :asset-path tough

isaac_cambron18:04:19

Cool, I'll check it out (though I'm not using Leing). I'm increasingly confident my issue is some of the build wackiness I'm doing, which is reassuring, actually

darwin18:04:54

also check out chromex library, might come handy

isaac_cambron18:04:41

yeah, it's very cool. If I were starting a new project, I'd almost certainly use it