Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If Clojurescript can actually work with Webpack and external modules under advanced compilation that is pretty amazing progress. Probably the biggest improvement in half a decade.


Unless I'm misunderstanding the ClojureScript team posts, one of the motivations for tight webpack integration is that not every npm module is compatible with advanced compilation.

From the article[0]:

> But after nearly three years since we first shipped Node module processing via Closure, it’s apparent that too few of the most popular libraries can be subjected to advanced optimizations. While we still believe there’s promise here, the ClojureScript community will have to show the rest of the world the way by developing compelling JavaScript libraries that can be readily consumed by popular JavaScript tools, yet still be subjected to Closure’s phenomenal tree shaking and code splitting when building with ClojureScript.

0: https://clojurescript.org/news/2020-04-24-bundle-target


Is this likely? Clojurescript comes with a pretty big base bundle size due to the runtime, right? Like hello world is still over 100kb or something before gzip, right? (On my phone, so it’s hard to google the exact number.)


That was a bug. It was fixed with this release, and swannodette added a test to ensure the size stays under 10k bytes: https://github.com/clojure/clojurescript/commit/5d64c2a142e5...


Swank! That’s a massive improvement. I’m going to spin up a Preact project and see how it fares.


Can’t shadow-cljs already do that, or?


Yep. But having this feature only in shadow-cljs doesn't do much for the ecosystem as a whole since non-portable. With this change, many tools, cljsbuild, Figwheel, etc. have the same capabilities. It also opens the door for creating ClojureScript libraries that depend on node_modules and these can again be consumed with any tool.


Thank you so much for all of your work on ClojureScript, @swannodette!

I love the work that's been done on shadow-cljs (and the maintainer is amazing) -- I've had a vastly easier and more stable time than with JS bundlers.

That said, in building a business on top of Clojure(Script), it's incredibly reassuring to know that shadow isn't a single point of failure.

This feature will make integrating/selling ClojureScript into existing projects easier too -- I only wish that I'd had this when moving from company to company a few years ago -- I'd have brought ClojureScript to a number of places. :)


@swannodette In the library case does the cljs built library need a clojure runtime bundled? Or does banning eval and running it through Closure allow for only the bare minimum to be pulled through?


Just wanted to pile on the thanks, too. CLJS spoiled me for just about any other way of doing front end work.


Thanks David, that sounds pretty great!




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

Search: