7 ms·
Using JavaScript Modules in ClojureScript
- ethagnawl 10y agoIs 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 10y agoTry `node --use_strict main.js`
- ethagnawl 10y agoThanks - that worked! Do you know why that's necessary and why it wasn't mentioned in the tutorial?
- swannodette 10y agoYou probably need to install a more recent version of Node.js. That's one of the first things mentioned.
- ethagnawl 10y agoThanks, 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!
- ethagnawl 10y agoOne more thing: the `repl/repl*` function call's map argument is missing a closing `}`.
- reilly3000 10y agoI'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!
- babbeloski 10y agoClojurescript 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)
- tomerweller 10y agoThe 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-from-npm http://blob.tomerweller.com/reagent-import-react-components-...
- apviitanen 10y agoYeah, 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.