lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
jarcane 2018-08-30T05:22:36.000100Z

@hlolli No difference there I'm afraid.

jarcane 2018-08-30T08:28:28.000100Z

Filed a Github issue: https://github.com/anmonteiro/lumo/issues/421

2018-08-30T09:00:01.000100Z

@jarcane

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

+ hyperapp@1.2.8
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=> 

2018-08-30T09:01:27.000100Z

ah so you are compiling for the browser?

2018-08-30T09:01:31.000100Z

sorry I noticed that now

jarcane 2018-08-30T09:01:56.000100Z

@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.

2018-08-30T09:02:35.000100Z

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

2018-08-30T09:03:47.000100Z

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.

2018-08-30T09:04:27.000100Z

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

jarcane 2018-08-30T09:04:32.000100Z

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

2018-08-30T09:05:05.000100Z

can I download the whole project from this fancy websitE?

2018-08-30T09:05:26.000100Z

"sign in to download"

2018-08-30T09:06:29.000100Z

github login, np

jarcane 2018-08-30T09:06:45.000100Z

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

jarcane 2018-08-30T09:06:51.000100Z

Or I can clone it to Github

2018-08-30T09:07:31.000100Z

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

jarcane 2018-08-30T09:10:25.000100Z

Here's a github repo if it's easier: https://github.com/jarcane/cljs-on-glitch

2018-08-30T09:10:47.000100Z

perfect, much faster to test this that way

2018-08-30T09:11:58.000100Z

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

jarcane 2018-08-30T09:12:14.000100Z

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

jarcane 2018-08-30T09:13:18.000100Z

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.

2018-08-30T09:14:24.000100Z

2018-08-30T09:18:41.000100Z

@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.

jarcane 2018-08-30T09:24:36.000100Z

Same issue there as well.

2018-08-30T09:27:27.000100Z

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.

jarcane 2018-08-30T09:35:46.000100Z

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

jarcane 2018-08-30T09:37:15.000100Z

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

jarcane 2018-08-30T09:37:20.000100Z

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)

jarcane 2018-08-30T09:38:16.000100Z

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)

2018-08-30T09:38:51.000100Z

yes I got that too, something in your code there

jarcane 2018-08-30T09:41:29.000100Z

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

2018-08-30T09:42:07.000100Z

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

2018-08-30T09:42:34.000100Z

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

2018-08-30T09:43:13.000100Z

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

jarcane 2018-08-30T09:53:08.000100Z

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

2018-08-30T09:57:29.000100Z

- check the node version - delete all old build files

jarcane 2018-08-30T09:58:26.000100Z

app@wise-feet:~ 09:52 
$ npm -v
5.6.0
app@wise-feet:~ 09:52 
$ pnpm -v
2.14.4
app@wise-feet:~ 09:52 
$ npx -v
9.6.1
app@wise-feet:~ 09:52 
$ node -v
v8.11.4

2018-08-30T10:01:43.000100Z

lumo 1.9.0-alpha is built against 9.10.0

2018-08-30T10:02:50.000100Z

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

jarcane 2018-08-30T10:13:35.000100Z

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. 😞

richiardiandrea 2018-08-30T15:31:03.000100Z

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

richiardiandrea 2018-08-30T15:31:29.000100Z

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