Update 0.8-upgrade.md

This commit is contained in:
Juho Teperi 2018-04-04 20:41:03 +03:00 committed by GitHub
parent a805717b9f
commit 0f21312e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -3,8 +3,6 @@
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+ |
@ -12,6 +10,8 @@ While Reagent 0.8 supports use with React from npm, there are known problems.
| `node modules` | `:none` | Known problems (1) | Supported |
| `node modules` | `:advanced` | Known problems (2) | Supported |
While Reagent 0.8 supports use with React from npm, there are known problems:
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.
@ -23,17 +23,21 @@ the default in next ClojureScript release.
## Browser - Cljsjs
**This is the recommended setup.**
Using Reagent with Cljsjs packages doesn't require changes,
other than making sure you update Cljsjs React dependencies,
if you have direct dependencies to them.
To ensure Cljsjs libs are used instead of Node Modules, you can add `:npm-deps false`, which will make sure ClojureScript compiler doesn't look into `node_modules` directory if it exists.
## Browser - node modules
If `react`, `react-dom` and `create-react-class` are available in `node_modules`
directory, ClojureScript compiler will use these with Reagent. To disable this by adding `:npm-deps false` compiler option.
directory, ClojureScript compiler will use these with Reagent.
If you don't want to call `npm` and manage `package.json`, you can use `:npm-deps` and `:install-deps` compiler options to
install the packages automatically.
have ClojureScript install the packages automatically.
You can use `:process-shim` compiler option to provide `process.env.NODE_ENV`
constant which is used by JS code to enable development and production
@ -76,7 +80,7 @@ If your bundle provides other libraries, you could extern `:provides` and `:glob
Requires https://github.com/clojure/clojurescript/commit/f7d611d87f6ea8a605eae7c0339f30b79a840b49
Available in 1.0.46+
Available in 1.0.238
Reagent should use Cljsjs libraries by default even when running on Node.