What's the simplest way to compile ClojureScript to JS? Like 1 file, no overhead.
bop

bop @bop

About: I'm a software developer currently working on multiple projects at Kellton Tech. Mostly doing TypeScript and React on a daily basis, focusing on front-end work. On a side note I also work with Clojure

Location:
Ribeirão Preto, Brazil
Joined:
Jan 13, 2022

What's the simplest way to compile ClojureScript to JS? Like 1 file, no overhead.

Publish Date: May 11 '22
2 1

Comments 1 total

  • Ben Lovy
    Ben LovyMay 12, 2022

    I think the best overall solution is shadow-cljs, but this requires a project setup. If you just want to transform some CLJS code, try something like this in a CLJS repl:

    (require '[cljs.js :refer [empty-state compile-str]])
    
    (compile-str (empty-state) "(defn add [x y] (+ x y))" #(println (:value %)))
    
    Enter fullscreen mode Exit fullscreen mode

    Check the cljs.js/compile-str docs.

Add comment