Add note about using local foreign-lib definitions

This commit is contained in:
Juho Teperi 2017-07-31 14:16:16 +03:00
parent a3b9b48ff2
commit 3f8350463c
1 changed files with 26 additions and 0 deletions

View File

@ -12,6 +12,32 @@ if you have direct dependencies to them.
If you use additional React packages, you need to update Cljsjs packages If you use additional React packages, you need to update Cljsjs packages
for these to use new React foreign-lib name, `react` instead of `cljsjs.react`. for these to use new React foreign-lib name, `react` instead of `cljsjs.react`.
**Subject to change, if this can be solved easily.** **Subject to change, if this can be solved easily.**
As a quick fix, you can add updated foreign-lib definition to your project,
like following example for react-leaflet, and update your project
to refer to the new name, and at the same time your can start using
`:global-exports`:
```cljs
:foreign-libs [{:file "cljsjs/development/react-leaflet.inc.js"
:file-min "cljsjs/production/react-leaflet.min.inc.js"
:provides ["react-leaflet"]
:requires ["react"]
:global-exports {react-leaflet ReactLeaflet}}]}}
```
Old code:
```cljs
(ns ... (:require cljsjs.react-leaflet))
(def Map (r/adapt-react-class js/ReactLeaflet.Map))
```
New code:
```cljs
(ns ... (:require [react-leaflet :as react-leaflet]))
(def Map (r/adapt-react-class react-leaflet/Map))
```
## Browser - node modules ## Browser - node modules