lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
borkdude 2018-05-26T16:21:09.000045Z

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.

richiardiandrea 2018-05-26T16:46:41.000085Z

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

richiardiandrea 2018-05-26T16:47:35.000101Z

You can also run lumo -c src foo directly

richiardiandrea 2018-05-26T16:49:33.000041Z

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

richiardiandrea 2018-05-26T16:50:40.000050Z

Sorry on mobile now but there is a back quote there

anmonteiro 2018-05-26T17:03:59.000084Z

@borkdude specify :target :nodejs

anmonteiro 2018-05-26T17:04:04.000009Z

you’re compiling for the browser

borkdude 2018-05-26T17:39:43.000007Z

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

borkdude 2018-05-26T17:44:09.000151Z

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

richiardiandrea 2018-05-26T18:15:02.000051Z

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

richiardiandrea 2018-05-26T18:16:02.000034Z

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

anmonteiro 2018-05-26T18:41:17.000018Z

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

borkdude 2018-05-26T19:14:52.000014Z

I’m using 1.8.0, installed with brew

borkdude 2018-05-26T21:02:47.000007Z

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

richiardiandrea 2018-05-26T23:54:54.000025Z

@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

richiardiandrea 2018-05-26T23:55:22.000009Z

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

richiardiandrea 2018-05-26T23:56:05.000035Z

Is it working with lumo and the cljs namespace directly?

anmonteiro 2018-05-26T23:56:31.000057Z

node out/main.js should work

anmonteiro 2018-05-26T23:56:57.000075Z

oh I know what else is wrong

anmonteiro 2018-05-26T23:57:15.000052Z

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

richiardiandrea 2018-05-26T23:57:24.000086Z

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

richiardiandrea 2018-05-26T23:57:54.000024Z

Oh I thought that would trigger a warning

anmonteiro 2018-05-26T23:58:20.000019Z

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

richiardiandrea 2018-05-26T23:58:41.000030Z

Oh right that's true