@hlolli No difference there I'm afraid.
Filed a Github issue: https://github.com/anmonteiro/lumo/issues/421
➜ 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=>
ah so you are compiling for the browser?
sorry I noticed that now
@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.
It obviously works, just doesn't compile correctly it seems...
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.
basically every time when interoping with js libraries, you need js objects. But clj objects for cljs libs.
Yeah, that needs to be fixed, but I'm pretty sure that should at least be a different error.
can I download the whole project from this fancy websitE?
"sign in to download"
github login, np
click the name, under advanced options, you can download project
Or I can clone it to Github
now I clicked asked to join, to be able to download it via this website
Here's a github repo if it's easier: https://github.com/jarcane/cljs-on-glitch
perfect, much faster to test this that way
pro-tip, you should probably make a macro for this framework hyperapp
, to fill in all the #js etc...
Yeah, I will probably do just that once I get it working.
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.
@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.
Same issue there as well.
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.
Yeah. On glitch it's all only installed locally (you don't get sudo access to the container)
Interesting. If I call it and run it locally, I do get a different error:
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)
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)
yes I got that too, something in your code there
Yeah, which means the require is probably working and I'm just bad at JS interop. XD
It could be that getting valus via keywords with IFn doesn't work.. let me check
cljs.user=> (:a #js {:a 1})
nil
cljs.user=> (aget #js {:a 1} "a")
1
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
- check the node version - delete all old build files
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
lumo 1.9.0-alpha is built against 9.10.0
delete public/main.js
and public/js
and try to compile again
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. 😞
There are three versions compiled against, I just don't know if they are all linked to the GitHub releases
But lumo is compiled against three versions, will try to link to them later