From 3f8350463c6a2ca6b97239bf0a84b265dd4e0101 Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Mon, 31 Jul 2017 14:16:16 +0300 Subject: [PATCH] Add note about using local foreign-lib definitions --- docs/0.8-upgrade.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/0.8-upgrade.md b/docs/0.8-upgrade.md index 39798a1..1167121 100644 --- a/docs/0.8-upgrade.md +++ b/docs/0.8-upgrade.md @@ -12,6 +12,32 @@ if you have direct dependencies to them. 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`. **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