mirror of https://github.com/status-im/reagent.git
Update 0.8-upgrade.md
This commit is contained in:
parent
035ba9cf29
commit
26858c3df3
|
@ -26,7 +26,32 @@ builds. ClojureScript compiler will automatically set this constant to
|
|||
`production` value when using `:advanced` optimizations. This enables
|
||||
the React production build.
|
||||
|
||||
## NodeJS
|
||||
## Browser - loading React from CDNJS or custom Webpack bundle
|
||||
|
||||
**TODO: Not tested properly**
|
||||
|
||||
If you want to load React.js yourself from external JS file (CDN) or from custom bundle,
|
||||
it should be possible to override the Cljsjs foreign-libs, while still using externs from Cljsjs packages. To override the foreign-libs, you can provide following compiler option:
|
||||
|
||||
```clj
|
||||
:foreign-libs
|
||||
[{:file "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}}]
|
||||
```
|
||||
|
||||
You'll also need to create the mentioned `empty.js` file (FIXME: relative to `project.clj`?).
|
||||
|
||||
If your bundle provides other libraries, you could extern `:provides` and `:global-exports` (e.g. `prop-types`).
|
||||
|
||||
## NodeJS - Cljsjs
|
||||
|
||||
Requires https://github.com/clojure/clojurescript/commit/f7d611d87f6ea8a605eae7c0339f30b79a840b49
|
||||
|
||||
Reagent should use Cljsjs libraries by default even when running on Node.
|
||||
|
||||
## NodeJS - node modules
|
||||
|
||||
Install `react`, `react-dom` and `create-react-class` npm packages,
|
||||
and ClojureScript should automatically use `require` to
|
||||
|
|
Loading…
Reference in New Issue