From b5a04f7d1a75bbae89187d31f6db39345ee9f3c3 Mon Sep 17 00:00:00 2001 From: Juho Teperi Date: Tue, 3 Apr 2018 11:56:49 +0300 Subject: [PATCH] Update Cljsjs for extern fix New externs fix isTextInputElement.supportedInputTypes function so range input works with optimizations. Fixes #321 --- docs/0.8-upgrade.md | 9 +++++++-- project.clj | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/docs/0.8-upgrade.md b/docs/0.8-upgrade.md index b3f9522..2837000 100644 --- a/docs/0.8-upgrade.md +++ b/docs/0.8-upgrade.md @@ -3,12 +3,14 @@ The necessary changes depend on what environment you target, and how you want to provide React. +While Reagent 0.8 supports use with React from npm, there are known problems. + | | Build | Browser | Node | |---|---|---|---| | 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 | +| `node modules` | `:none` | Known problems (1) | Supported | +| `node modules` | `:advanced` | Known problems (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. @@ -37,6 +39,9 @@ builds. ClojureScript compiler will automatically set this constant to `production` value when using `:advanced` optimizations. This enables the React production build. +When using module processing, it should be possible to split output into several +[modules](https://clojurescript.org/reference/compiler-options#modules). + ## Browser - loading React from CDNJS or custom Webpack bundle **TODO: Not tested properly** diff --git a/project.clj b/project.clj index 4982f0a..bc2ca16 100644 --- a/project.clj +++ b/project.clj @@ -8,9 +8,9 @@ ;; If :npm-deps enabled, these are used only for externs. ;; Without direct react dependency, other packages, ;; like react-leaflet might have closer dependency to a other version. - [cljsjs/react "16.3.0-0"] - [cljsjs/react-dom "16.3.0-0"] - [cljsjs/react-dom-server "16.3.0-0"] + [cljsjs/react "16.3.0-1"] + [cljsjs/react-dom "16.3.0-1"] + [cljsjs/react-dom-server "16.3.0-1"] [cljsjs/create-react-class "15.6.2-0"]] :plugins [[lein-cljsbuild "1.1.7"] @@ -28,7 +28,7 @@ [doo "0.1.10"] [cljsjs/prop-types "15.6.0-0"]] :source-paths ["demo" "examples/todomvc/src" "examples/simple/src" "examples/geometry/src"] - :resource-paths ["site" "target/cljsbuild/client"]}} + :resource-paths ["site" "target/cljsbuild/client" "target/cljsbuild/client-npm"]}} :clean-targets ^{:protect false} [:target-path :compile-path "out"] @@ -58,9 +58,8 @@ :source-map true :optimizations :none :main "reagentdemo.dev" - ;; Same output dir as :client build! - :output-dir "target/cljsbuild/client/public/js/out" - :output-to "target/cljsbuild/client/public/js/main.js" + :output-dir "target/cljsbuild/client-npm/public/js/out" + :output-to "target/cljsbuild/client-npm/public/js/main.js" :asset-path "js/out" ;; add process.env.node_env preload ; :npm-deps true @@ -130,6 +129,18 @@ ;; :pseudo-names true :output-to "target/cljsbuild/prod/public/js/main.js" :output-dir "target/cljsbuild/prod/out" ;; Outside of public, not published + :npm-deps false}} + + :prod-npm + {:source-paths ["src" "demo"] + :compiler {:main "reagentdemo.prod" + :optimizations :advanced + :elide-asserts true + :pretty-print false + :pseudo-names true + :output-to "target/cljsbuild/prod-npm/public/js/main.js" + :output-dir "target/cljsbuild/prod-npm/out" ;; Outside of public, not published + :process-shim true :closure-warnings {:global-this :off}}} :prod-test