8000 Unclear how to use new :preprocess in :foreign-libs · Issue #151 · boot-clj/boot-cljs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unclear how to use new :preprocess in :foreign-libs #151
Closed
@skynet-gh

Description

@skynet-gh

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0