Clojurians
#lumo
<
2018-08-30
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

jarcane05:08:36

@hlolli No difference there I'm afraid.

hlolli09:08:01

@jarcane

➜  npm i hyperapp                                                                                                           ~/tmp/closure
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN You are using a pre-release version of node and things may not work as expected

+ [email protected]
added 1 package from 1 contributor and audited 18 packages in 2.147s
found 0 vulnerabilities
➜  lumo                                                                                                                     ~/tmp/closure
Lumo 1.9.0-alpha
ClojureScript 1.10.238
Node.js v9.11.2
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (def hypapp (js/require "hyperapp"))
#'cljs.user/hypapp
cljs.user=> hypapp
#js {:h #object[Function], :app #object[Function]}
cljs.user=> 
I still think that hyperapp is getting compiled in your example. You can also require it like this
cljs.user=> (require '["hyperapp" :as hy])
nil
cljs.user=> hy
#js {:h #object[Function], :app #object[Function]}
cljs.user=> 

hlolli09:08:27

ah so you are compiling for the browser?

hlolli09:08:31

sorry I noticed that now

jarcane09:08:56

@hlolli This is targeting a browser, yes. so js/require won't work. I also tried using the string name and that fails to compile.

hlolli09:08:35

It obviously works, just doesn't compile correctly it seems...

hlolli09:08:47

I notice in your code as well, that you're useing clj maps {} but it should most defenitely be #js {}, if you're used to reagent, then behind the scened, all clj maps are converted to json maps.

hlolli09:08:27

basically every time when interoping with js libraries, you need js objects. But clj objects for cljs libs.

jarcane09:08:32

Yeah, that needs to be fixed, but I'm pretty sure that should at least be a different error.

hlolli09:08:05

can I download the whole project from this fancy websitE?

hlolli09:08:26

"sign in to download"

hlolli09:08:29

github login, np

jarcane09:08:45

click the name, under advanced options, you can download project

jarcane09:08:51

Or I can clone it to Github

hlolli09:08:31

now I clicked asked to join, to be able to download it via this website

hlolli09:08:47

perfect, much faster to test this that way

hlolli09:08:58

pro-tip, you should probably make a macro for this framework hyperapp, to fill in all the #js etc...

jarcane09:08:14

Yeah, I will probably do just that once I get it working.

jarcane09:08:18

There's also an @hyperapp/html package that provides helper functions for the HTML that's a bit more readable. For now I just wanted to get it working.

hlolli09:08:41

@jarcane try using 1.9.0-alpha instead of 1.8.0. There's a lot of work being done on the closure compiler in relation to node modules these days.

jarcane09:08:36

Same issue there as well.

hlolli09:08:27

I noticed that by doing npm run start it used the lumo from node_modules, so if you installed lumo 1.9.0-alpha globally, if could still pick up your local lumo 1.8.0, just to rule all out.

jarcane09:08:46

Yeah. On glitch it's all only installed locally (you don't get sudo access to the container)

jarcane09:08:15

Interesting. If I call it and run it locally, I do get a different error:

jarcane09:08:20

Uncaught TypeError: Cannot read property 'call' of null
    at app$main$view (main.cljs?rel=1535621752659:17)
    at resolveNode (index.js:5)
    at render (index.js:5)

jarcane09:08:16

So the require seems to be working there but it's throwing an error in my actual code (the last line of the view function)

hlolli09:08:51

yes I got that too, something in your code there

jarcane09:08:29

Yeah, which means the require is probably working and I'm just bad at JS interop. XD

hlolli09:08:07

It could be that getting valus via keywords with IFn doesn't work.. let me check

hlolli09:08:34

cljs.user=> (:a #js {:a 1})
nil

hlolli09:08:13

cljs.user=> (aget #js {:a 1} "a")
1

jarcane09:08:08

OK, managed to fix the issues in the CLJS so it at least throws no errors (though it also rendered nothing so ...), but it's odd that it only works locally. I'm wondering if there's a problem with the version of node deployed on Glitch

hlolli09:08:29

- check the node version - delete all old build files

jarcane09:08:26

[email protected]:~ 09:52 
$ npm -v
5.6.0
[email protected]:~ 09:52 
$ pnpm -v
2.14.4
[email protected]:~ 09:52 
$ npx -v
9.6.1
[email protected]:~ 09:52 
$ node -v
v8.11.4

hlolli10:08:43

lumo 1.9.0-alpha is built against 9.10.0

hlolli10:08:50

delete public/main.js and public/js and try to compile again

jarcane10:08:35

Damn. Still nothin'. v8.11.4 is the current LTS which is probably why Glitch uses it. May be there's a compatibility issue here. :disappointed:

richiardiandrea15:08:03

There are three versions compiled against, I just don't know if they are all linked to the GitHub releases

richiardiandrea15:08:29

But lumo is compiled against three versions, will try to link to them later