From 12d590ff155abe6a9d2096578b17622eb0f4b4f5 Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Tue, 3 Apr 2018 10:53:05 +0300 Subject: [PATCH] Document React 16 problems with npm-deps --- circle.yml | 3 ++- docs/0.8-upgrade.md | 15 +++++++++++---- project.clj | 5 +++-- test/reagenttest/testwrap.cljs | 2 -- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/circle.yml b/circle.yml index 16fe961..029a6ed 100644 --- a/circle.yml +++ b/circle.yml @@ -18,6 +18,7 @@ jobs: paths: - ~/.m2 - ~/.lein + - ~/.cljs/.aot_cache key: reagent-{{ checksum "project.clj" }} - save_cache: paths: @@ -29,7 +30,7 @@ jobs: deploy_master: working_directory: ~/work docker: - - image: circleci/clojure:lein-2.7.2 + - image: circleci/clojure:lein-2.8.1 steps: - checkout - add_ssh_keys diff --git a/docs/0.8-upgrade.md b/docs/0.8-upgrade.md index d4976ee..b3f9522 100644 --- a/docs/0.8-upgrade.md +++ b/docs/0.8-upgrade.md @@ -5,10 +5,17 @@ how you want to provide React. | | Build | Browser | Node | |---|---|---|---| -| Cljsjs | `:none` | Supported | Requires Cljs 1.10.145+ | -| Cljsjs | `:advanced` | Supported | Requires Cljs 1.10.145+ | -| `node modules` | `:none` | Supported | Supported | -| `node modules` | `:advanced` | Supported | Partially supported
(`ReactDOM/server` currently broken) | +| Cljsjs | `:none` | Supported | Requires Cljs 1.10.238+ | +| Cljsjs | `:advanced` | Supported | Requires Cljs 1.10.238+ | +| `node modules` | `:none` | Partially supported (1) | Supported | +| `node modules` | `:advanced` | Partially supported (2) | Supported | + +1. Closure can't properly handle React 16 CommonJS module pattern: https://github.com/google/closure-compiler/issues/2841 +This causes the production React code being loaded even for development builds. +Using Chrome React Developer Tools with this setup will break Reagent. + +2. Closure optimization currently breaks certain statically created objects which are +accessed dynamically in `ReactDOM/server`: https://github.com/facebook/react/issues/12368 ## Browser - Cljsjs diff --git a/project.clj b/project.clj index 9ff731e..4982f0a 100644 --- a/project.clj +++ b/project.clj @@ -58,8 +58,9 @@ :source-map true :optimizations :none :main "reagentdemo.dev" - :output-dir "target/cljsbuild/client-npm/public/js/out" - :output-to "target/cljsbuild/client-npm/public/js/main.js" + ;; Same output dir as :client build! + :output-dir "target/cljsbuild/client/public/js/out" + :output-to "target/cljsbuild/client/public/js/main.js" :asset-path "js/out" ;; add process.env.node_env preload ; :npm-deps true diff --git a/test/reagenttest/testwrap.cljs b/test/reagenttest/testwrap.cljs index 1198ec3..9e55b43 100644 --- a/test/reagenttest/testwrap.cljs +++ b/test/reagenttest/testwrap.cljs @@ -194,8 +194,6 @@ (fn [] (is (= @a-count 3)) (is (= @b-count 1))) - (fn [] - (js/console.log "test-cursor done")) done))))))) (deftest test-fn-cursor