it’s been a while since I used lumo. Say I have foo/build.cljs and foo/src/foo.cljs build.cljs:
(require 'lumo.build.api)
(lumo.build.api/build "src" {:output-to "out/main.js"})
foo.cljs:
(ns foo)
(defn main []
(println (+ 1 2 3)))
I run
lumo -c src build.cljs
Now how I do run the project?
out/main.js
gives an error.@borkdude have you tried node out/main.js
?
You can also run lumo -c src foo
directly
Actually I think the last works only if you set (set! *main-cli-fn*
``-main)`
Sorry on mobile now but there is a back quote there
@borkdude specify :target :nodejs
you’re compiling for the browser
ok cool, did that. now I get: ReferenceError: goog is not defined
maybe I should have a package.json? is there an example lumo project that uses the build api?
@borkdude random shot in the dark, maybe you need to cd into out
One thing I did in a project was to create a unique JS file with browserify: https://github.com/paullucas/les-clj/blob/master/scripts/build
@borkdude that’s weird. Let’s get you up & running, are you using 1.9.0-alpha?
I’m using 1.8.0, installed with brew
is there some example project/template which uses the build api? then I can use that to get going
@borkdude no there is no template yet but I think you are compiling correctly. It is just a matter of launching node with the right path
I have been meaning to produce a template but haven't had the time yet
Is it working with lumo
and the cljs namespace directly?
node out/main.js
should work
oh I know what else is wrong
@borkdude this will give an error in 1.9.0-alpha, but :target :nodejs
needs a :main
entry in the compilation options
As strange as it sounds, I have never launched a script directly with node
Oh I thought that would trigger a warning
@richiardiandrea it does, in 1.9.0-alpha. He’s using 1.8.0
Oh right that's true