
Using JavaScript Modules in ClojureScript - fnordsensei
https://clojurescript.org/guides/javascript-modules
======
babbeloski
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)

------
ethagnawl
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

~~~
Arnavion
Try `node --use_strict main.js`

~~~
ethagnawl
Thanks - that worked!

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

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

~~~
ethagnawl
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!

------
tomerweller
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-...](http://blob.tomerweller.com/reagent-import-react-components-
from-npm)

~~~
apviitanen
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.

------
reilly3000
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!

