Fork me on GitHub
#clojurescript
<
2017-04-30
>
renan00:04:56

Hi guys 😃 , I using Re-frame + reagent-material-ui and i need reuse my header and footer in my other pages / components, how do i write this?

tianshu04:04:48

@anmonteiro Hi, I try to use :npm-deps according to your blog Requiring Node.js modules from ClojureScript namespaces. I declare {:npm-deps {:react "15.5.4", :react-dom "15.5.4"}}, when the page load, It complains Uncaught ReferenceError: process is not defined. It seems this is a internal dependency of React. how to solve this?

anmonteiro04:04:38

@doglooksgood yeah so React has the dependency on process.env.NODE_ENV which is available on Node.js

tianshu05:04:44

is that :npm-deps available for boot-cljs? and it seems like the only thing I need to do is :closure-defines {'process.env/NODE_ENV "production"} ? And I saw b/node-inputs in both this commit and the tutorial of JavaScript Modules on http://clojurescript.org. Is this necessary if I use :npm-deps?

tianshu05:04:46

this part really confuse me, since there're so many ways to require a foreign javascript library.

anmonteiro05:04:40

@doglooksgood you need to have the process.env namespace for closure-defines to override the goog-define. node-inputs is not necessary, that commit refers to a previous version of the ClojureScript compiler

anmonteiro05:04:02

and it works with boot-cljs, yes

tianshu05:04:14

still not work 😢 I have cljs task like this:

(cljs :source-map true
              :optimizations :none
              :compiler-options {:npm-deps {:react     "15.5.4"
                                            :react-dom "15.5.4"}
                                 :closure-defines {'process.env/NODE_ENV "development"}
                                 :closure-warnings {:non-standard-jsdoc :off
                                                    :global-this        :off}})
I add a src/process.env.cljs which contains (goog-define NODE_ENV "development") and I require process.env in my core.cljs. I can even use (println process.env/NODE_ENV) to print "development", but I still got the error. I guess I must missed something.

tianshu08:04:55

https://github.com/anmonteiro/xact helped me a lot. It works fine on boot, now I'm trying to use it on figwheel.

quentinpaden20:04:15

Hey I'm in college and I'm working on my first app. After finishing a prototype in http://proto.io, I went on a hunt to discover the best technologies to use in making this actually happen. My goal is to learn Clojure and Clojurescript, then use om.next with some react.js libraries to get an idea of how to build carousel component and node.js to connect with a serverless backend that has access to cloud functions like Firebase/Google Cloud or Lambda/AWS. I have a lot of learning to do since I just got in to college but Clojure with react has made me excited to actually make this dream come true. One question I had however was concerning connecting node.js with clojurescript. When I looked up solutions and how to do it, It seemed like you had to do a bunch of things regarding dependencies. At this point I don't even know if there is a solution for fully integrating the front end Clojure with the backend node.js cloud stuff. Does anyone know if there is a simple or clear way in doing this?

tbaldridge21:04:26

No there is no simple and clear way to do this. It is possible, but way too much risk to take on in a small project.

tbaldridge21:04:58

(and to be fair, you already have a ton of stuff to learn)

quentinpaden22:04:00

@tbaldridge thank you for the response. I guess I will just use datomic.