Hi all,

I want to use reagent 0.8 with an external React 16, available as 
`window.React` (equivalent to using React from a CDN, but in reality built 
and exported from a separate webpack bundle).

My goal is to build a bundle which uses React, ReactDOM and 
createReactClass from the window object, instead of inlining its own copies 
of those libraries.

I talked to @Deraen about this on Slack a couple of months ago who helped 
me get this working. I'm currently able to build a bundle as described 
above, but I have to vendor in all the extern files from the relevant 
cljsjs React libraries, and add them to :exclusions. My :compiler key in my 
cljsbuild config looks like this:

   :foreign-libs [{:file "src/js/empty.js"
                   :provides ["react" "react-dom" "create-react-class" 
"react-dom/server"]
                   :requires []
                   :global-exports {react React
                                    react-dom ReactDOM
                                    create-react-class createReactClass
                                    react-dom/server ReactDOMServer}}]
   :externs ["src/js/externs/react.ext.js"
             "src/js/externs/react-dom.ext.js"
             "src/js/externs/create-react-class.ext.js"]

He thought at the time that it should be possible without the externs and 
:exclusions, as mentioned on this page: 
https://github.com/reagent-project/reagent/blob/master/docs/0.8-upgrade.md#browser---loading-react-from-cdnjs-or-custom-webpack-bundle

> it should be possible to override the Cljsjs foreign-libs, while still 
using externs from Cljsjs packages.

But I can't figure it out - if I don't exclude the cljsjs libraries, I get 
a bundle with React 15 built-in, and if I do exclude them, the bundle is 
broken because the externs are missing and the names get eaten by the 
closure compiler.

Is there any way around having to commit the externs?

Thanks,
Alex

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to