Hacker News new | past | comments | ask | show | jobs | submit login

I've been learning Clojure and ClojureScript in my spare time. I can honestly say that one thing that would make adoption a lot more wide-spread is a better way to include NPM modules in the project.

I know that there is a new feature for it, but the documentation was a little cryptic. Ended up just adding some CLJSJS dependencies to my project and giving up on using the NPM module I _really_ wanted to use.

In the end, that could be because i'm just lazy, though. I'd love to hear what others think on this topic.




Support for NPM modules out of the box is a hot topic in the cljs community, imo things have greatly improved even in the past few months.

Checkout https://github.com/anmonteiro/lumo And https://andrearichiardi.com/blog/posts/lumo-npm-dependencies...


NPM basically does not work with the standard Clojurescript compiler. I would avoid mentioning this topic around newbies, as it will only result in frustration.


Try shadow-cljs https://news.ycombinator.com/item?id=16866085 you want npm modules in ClojureScript and you get npm modules in your ClojureScript. If not, then I'm quite sure you can get help from thheller who created shadow-cljs.


I'll have to look at that. It may provide a solution to my problems.

Does shadow-cljs integrate well into an existing figwheel/reagent project?


I use shadow-cljs as a replacement of figwheel. shadow-cljs is quite powerful already, in development and bundling.


oh, its a _replacement_ for figwheel. Gotcha. In that case, I'll take a look and get it going.

Thanks!


Been working on a cljs project and took me a solid week to get npm integration working. The documentation is either wrong or incomplete on both the official site and the wikis for lein/boot.


Still, please try shadow-cljs https://news.ycombinator.com/item?id=16866085 and join us on Slack.


Yep, that's what I ended up discovering and going with.

However, shadow-cljs REPL integration was also pretty hard to get working with my editor (spacemacs), because most of the tutorials assume you're using lein to build your project.

shadow-cljs is pretty dope though. Almost instantaneous rebuild times and basically no setup besides a small, understandable config file.


It's helpful to post doc problems / questions on the clojurescript-site issues so that it can be improved.

https://github.com/clojure/clojurescript-site/issues


i think the underlying problem is that the documentation is incomplete and/or outright incorrect.

CLJSJS was a life-saver for me, at least.


Work on this is still ongoing. Clojurescript had to upstream a lot of module-handling code into Google Closure to get it going, and older, non-Node/ES6 module libs will never work under advanced-mode compilation (e.g., polyfills).


I really had high hopes for Clojurescript but I tried many times to get my front-end finished in Reagent but the documentation was useless. In the end I turned to React and, with the help of a good, detailed video tutorial, I had it finished in a week. Ecosystem really matters and I find that Clojurescript, despite its innovations, is still too bits and pieces when it comes to just getting stuff done. I never thought I'd give-up on Clojurescript but eventually I did.




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

Search: