This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-21
Channels
- # aws (2)
- # bangalore-clj (14)
- # beginners (20)
- # boot (20)
- # cider (7)
- # cljs-dev (38)
- # cljsrn (13)
- # clojure (487)
- # clojure-argentina (3)
- # clojure-dev (15)
- # clojure-gamedev (4)
- # clojure-italy (3)
- # clojure-poland (1)
- # clojure-russia (1)
- # clojure-spec (25)
- # clojure-uk (47)
- # clojurescript (127)
- # datomic (125)
- # defnpodcast (1)
- # hoplon (27)
- # jobs (4)
- # lein-figwheel (2)
- # leiningen (1)
- # luminus (5)
- # off-topic (3)
- # om (25)
- # onyx (9)
- # parinfer (3)
- # pedestal (20)
- # planck (65)
- # re-frame (43)
- # reagent (4)
- # remote-jobs (1)
- # ring-swagger (2)
- # rum (9)
- # spacemacs (1)
- # unrepl (37)
- # vim (1)
Hi guys! How can I rewrite this function with spawn instead of exec? I tried but got ENOENT errors
(defui build-configuration [this]
[:button {:type "button"
:style {:margin-left 15}}
"Build"]
:click #(do
(when (:builder @state)
(kill-process (:builder @state)))
(let [builder (.exec child-process (str "cd " (:path @this)
(if (= (:build @this) "dev")
(str (if (= (:platform @this) "android")
" && adb reverse tcp:8081 tcp:8081 && adb reverse tcp:3449 tcp:3449"
"")
" && re-natal use-" (:platform @this) "-device " (:device @this)
" && re-natal use-figwheel && lein figwheel " (:platform @this))
" && lein prod-build")))]
(-> (.-stdout builder)
(.on "data" (fn[data]
(println data))))
(-> (.-stderr builder)
(.on "data" (fn[data]
(println data))))
(swap! state assoc :builder builder))))
Perhaps take a look at this thread? https://groups.google.com/forum/#!topic/clojurescript/TObqicBxmKQ
One difference between exec
and spawn
is whether the process executes in a shell by default. In node it seems, exec
defaults to running the command via bash, but spawn
defaults to no shell. That could be a problem; for example your command runs multiple programs in series via &&
, which is a shell construct.
Hi friends, I'm having trouble getting React to play nicely in figwheel with the latest version of clojurescript
I'm trying to use the new functionality described in https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules
Here's what I've done so far:
+ Checked out the latest version of Clojureuscript
+ Run script/build
+ BUILD SUCCESS for 1.9.820
+ lein new figwheel example
+ Edit project.clj
with the following:
- Update org.clojure/clojurescript "1.9.820"
- Update lein-figwheel "0.5.11"
(also sidecar to match)
- Update lein-cljsbuild "1.1.6"
- Update the cljsbuild compiler options to include :npm-deps {:react "15.6.1" :react-dom "15.6.1"}
+ Change the default core.cljs
to match the simple example in the news post above
+ Start a REPL (so VIM can connect to it)
+ lein figwheel
in another shell
The page renders the default Figwheel template and gives me no CLJS errors, but React spits out a ton in the web console: Uncaught ReferenceError: process is not defined
Is there some step that I've missed in order to get NPM deps to magically compile?
That sounds like figwheel
or cljsbuild
is not using the latest version of ClojureScript (`1.9.820`) . Try using excluding the ClojureScript dependecies.
Like so [figwheel "0.5.11" :exclusions [org.clojure/clojurescript]]
I've got the following now:
[lein-figwheel "0.5.11" :exclusions [org.clojure/clojurescript]]
[lein-cljsbuild "1.1.6" :exclusions [org.clojure/clojure org.clojure/clojurescript]]
seems to compile, but I get the same error
Oh wait you're running this in the browser right?
Yes sir, trying to view it through the default figwheel URL: http://localhost:3449/
You have to run the example in node
since the react.dom/server
is server side rendering
That would might work. I'd try compiling the example exactly how it's shown in the blog post first
Looks like I get errors in node because Figwheel is injecting some stuff under the assumption that the document
variable exists. Thanks for the help!
You're welcome, I'd file an issue in the figwheel project and setup a sample repo showing the behavoir