Clojurians
#lumo
<
2018-05-26
>

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

borkdude16:05:09

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.

richiardiandrea16:05:41

@borkdude have you tried node out/main.js ?

richiardiandrea16:05:35

You can also run lumo -c src foo directly

richiardiandrea16:05:33

Actually I think the last works only if you set (set! *main-cli-fn* ``-main)`

richiardiandrea16:05:40

Sorry on mobile now but there is a back quote there

anmonteiro17:05:59

@borkdude specify :target :nodejs

anmonteiro17:05:04

you’re compiling for the browser

borkdude17:05:43

ok cool, did that. now I get: ReferenceError: goog is not defined

borkdude17:05:09

maybe I should have a package.json? is there an example lumo project that uses the build api?

richiardiandrea18:05:02

@borkdude random shot in the dark, maybe you need to cd into out

richiardiandrea18:05:02

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

anmonteiro18:05:17

@borkdude that’s weird. Let’s get you up & running, are you using 1.9.0-alpha?

borkdude19:05:52

I’m using 1.8.0, installed with brew

borkdude21:05:47

is there some example project/template which uses the build api? then I can use that to get going

richiardiandrea23:05:54

@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

richiardiandrea23:05:22

I have been meaning to produce a template but haven't had the time yet

richiardiandrea23:05:05

Is it working with lumo and the cljs namespace directly?

anmonteiro23:05:31

node out/main.js should work

anmonteiro23:05:57

oh I know what else is wrong

anmonteiro23:05:15

@borkdude this will give an error in 1.9.0-alpha, but :target :nodejs needs a :main entry in the compilation options

richiardiandrea23:05:24

As strange as it sounds, I have never launched a script directly with node

richiardiandrea23:05:54

Oh I thought that would trigger a warning

anmonteiro23:05:20

@richiardiandrea it does, in 1.9.0-alpha. He’s using 1.8.0

richiardiandrea23:05:41

Oh right that's true