Fork me on GitHub
#reagent
<
2018-04-10
>
lwhorton04:04:36

if i want to use my own CDN-provided version of react/react-dom/react-dom-server/create-react-class do I need to include a src/cljsjs/<all,those,files> namespace?

thheller09:04:20

in shadow-cljs you can configure this via :resolve. see https://shadow-cljs.github.io/docs/UsersGuide.html#_using_a_cdn

lwhorton14:04:25

that’s a nice feature. can I go in the other direction? can I build a bundle of all my node deps and :export them so another bundle can ref a globally exported js/namespace?

lwhorton14:04:03

right now i’m hacking around this by building all my “npm dependencies” into a single lib.js file, then invoking a -main fn inside a single namespace which simply requires all those libs and exports them onto js/window

thheller15:04:07

well you could (:require ["react" :as react]) and then (js/goog.exportSymbol "your.React" react) which would make window.your.React available when the file is loaded. wouldn't recommend doing that but it is possible.

lwhorton04:04:56

and similarly :exclude [ all those requirements ]?

pesterhazy09:04:51

@mattly how do you integrate those pure js components?

pesterhazy09:04:27

@lwhorton that's how things are done usually, yes

pesterhazy09:04:25

I think there were are changes related to this in reagent 0.8 so not sure if this is still true with that version

thheller10:04:00

@mattly it might be this https://github.com/google/closure-compiler/issues/2822. are you using closure compiler version v20180204?

troglotit15:04:19

did anyone tried using reagent with javelin? How did it go?

mattly16:04:16

@thheller I’m not sure which closure compiler I’m using, presumably the one that comes with clojurescript 1.10.238 lein-cljsbuild 1.1.7

thheller16:04:49

yep thats the problem then. you can check with lein deps :tree

thheller16:04:08

1.10.238 has the "broken" version still

thheller16:04:51

you can manually add [com.google.javascript/closure-compiler-unshaded "v20180319"] or [com.google.javascript/closure-compiler-unshaded "v20180402"]. both have the fix.

mattly16:04:24

do I need to add that to the clojurescript exclusions?

thheller16:04:51

just remember to take that out when you bump the cljs version the next time. otherwise you might get stuck on an incompatible version in the future.

thheller16:04:15

not as long as you have the dependency in your project. that overrides whatever CLJS wants to bring in.

mattly16:04:24

I’ll give that a shot

mattly16:04:00

same problem

mattly16:04:04

here’s how I’m using it:

mattly16:04:42

I tried changing (.-default react-json-view) to (react-json-view) and the cljs compiler has been running for seven minutes now

mattly16:04:12

actually it’s just this version of the closure compiler …. after a lein clean any advanced build will go for at least ten minutes before I give up and kill it

mattly16:04:27

… and the problem persists even after removing the dependency on the new version of the closure compiler and blowing away ~/.m2/repository

mattly16:04:47

the closurescript compiler just hangs in advanced mode

mattly16:04:57

hopefully this won’t be an issue on our CI server

pesterhazy20:04:25

it should work with the "double bundle" method, using webpack: https://github.com/pesterhazy/presumably/blob/master/posts/double-bundle.md

pesterhazy20:04:12

Source: I've used react-json-view with reagent before

pesterhazy20:04:59

Granted, it's not as elegant as using the new cljs requires feature

mattly20:04:28

I’m just hacking together my own little data viewer widget

mattly20:04:44

halfway there 😄

mattly20:04:52

hopefully I can release it