Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Using JavaScript Modules in ClojureScript (clojurescript.org)
55 points by fnordsensei on Jan 27, 2017 | hide | past | favorite | 10 comments


Clojurescript is the most complete to JS languange. The build and developer tools are _ahead_ of Javascript. The language is great too, and it's pretty 1:1 with javascript, plus all the other goodies. It's not going to satisfy haskellers, but when you look at the big picture it wins over Elm (at the moment, I love Elm too)


Is anyone else having trouble following along at home?

I'm met with an error when running `node main.js`.

> SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode


Try `node --use_strict main.js`


Thanks - that worked!

Do you know why that's necessary and why it wasn't mentioned in the tutorial?


You probably need to install a more recent version of Node.js. That's one of the first things mentioned.


Thanks, David. Upgrading to Node 7.4.0 allowed me to run `node main.js` without having to pass the flag.

Granted, I was using an outdated version of Node, but perhaps it'd be helpful to add a >= version number to the Node dependency blurb (a la JDK 8).

Either way, thanks for your continued efforts!


One more thing: the `repl/repl*` function call's map argument is missing a closing `}`.


The fact that their example includes using cljsjs package for externs is troubling. For the meanwhile, to avoid worrying about extern files, I'd stick to using a separate build process for npm packages.

Shameless self promotion: http://blob.tomerweller.com/reagent-import-react-components-...


Yeah, but without externs this breaks on advanced compilation, right? So, while using webpack to bundle npm deps is a good idea (that might also get unnecessary in the future with things like node module resolution landing in cljs compiler), you still need externs for the functions you're going to call from your cljs code. Luckily the latest cljs compiler will help you get those right.


I'm super stoked about this. Also, it sucks that I can't just name NPM packages in my project.cljs and move on.

Because then I can play with NPM packages on my phone while I commute. Let's do this!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: