Closed
Description
I'm trying to follow the guide to the new ClojureScript features for JavaScript modules and am running into an issue adding preprocessors to boot-cljs. The guide uses lein, but I've tried to adapt it in this project.
The guide uses similar code to the clojurescript wiki to add preprocessors (in my build.boot):
(require '[clojure.java.io :as io]
'[cljs.build.api :as b]
'[cljs.closure :as closure])
(import 'javax.script.ScriptEngineManager)
(defmethod closure/js-transforms :jsx [ijs opts]
(let [code (str (gensym))
engine (doto (.getEngineByName (ScriptEngineManager.) "nashorn")
(.eval (io/reader (io/file "babel.min.js"))))]
(.put engine code (:source ijs))
(assoc ijs :source
(.eval engine (str "Babel.transform(" code
", {presets: ['react', 'es2016']}).code")))))
But, I guess because boot-cljs runs the compiler in a different pod, the preprocessor isn't picked up and I get this message in the console, and can't compile the jsx files:
WARNING: Unsupported preprocess value :jsx for foreign library src/js/hello.js. null
I know this feature is very new, but I'm interested in using it if it's available in boot, otherwise I might look into adding a way to pass it in. Thanks!
Metadata
Metadata
Assignees
Labels
No labels