v4.0.0
For the new major (v4.0.0) release, there'll be some breaking changes:
Breaking changes
-
Babel 7 update
- Since Babel 7 introduces some new scoped packages, please update to their new package (
env
->@babel/preset-env
,react
->@babel/preset-react
,transform-object-rest-spread
->@babel/plugin-proposal-object-rest-spread
) - Update all your preset stages to its individual plugins
module.exports
is readonly now (if used together withimport
syntax), please update your code accordingly (Babel 7 related)
- Since Babel 7 introduces some new scoped packages, please update to their new package (
-
The default of
handleRender
will bestringRenderer
, due many node stream limitation and 3rd party lib support -
New API for
universalRender
callback. It will only accept return value of:- either React element or
- Promise (that resolves React element)
// before: you still call rTS explicitly despite having stringRenderer declared... { handleRender: stringRenderer, universalRender: (req, res) => renderToString(<App />) }
// after: just return React element! (or Promise of React element) { universalRender: (req, res) => <App /> }
// Need to do Nodestream render? Just pass streamRenderer to `handleRender` import { streamRenderer } from '@cra-express/universal-loader' { universalRender: (req, res) => <App />, handleRender: streamRenderer } // Want to custom handleRender yourself? Possible now! function customRenderer(req, res, reactEl, htmlData, options) { ... }
-
handleUniversalRender
helper on@cra-express/core
is removed, since it won't be compatible with new API.// before universalRender: handleUniversalRender(<App />) // after universalRender: () => <App />
Features
- Babel 7
- New
universalRender
API NODE_PATH
support