Releases: antonybudianto/cra-universal
Releases · antonybudianto/cra-universal
Streaming Time
cra-universal@5.0.2
- Enable SSR streaming
- Activate via
App.defaultProps = { streaming: true }
(false
by default) App
must be the top-most element being rendered, if possible, put all your providers inside the App- If you have custom server, please check the
universalRender: (req, res) => <App streaming />
part - If you need to conditionally stream (
defaultProps
is not suited for this), please use custom server and set thestreaming
prop as you like
- Activate via
- Support TypeScript for custom server code in
babel-preset-cra-universal
The Five
cra-universal@5
- Supports latest
react-scripts@5
- React 18 with Suspense SSR support (using
renderToPipeableStream
by default)- User can still use string renderer (renderToString) by passing:
import stringRenderer from '@cra-express/universal-loader/lib/renderer/string-renderer'; ... createReactAppExpress({ handleRender: stringRenderer, })
- User can still use string renderer (renderToString) by passing:
- React Babel Automatic Runtime
- Webpack 5 + Babel 7
- Migrate lerna to pnpm
- Updated SVG support
- Updated docs for
hydrateRoot
changes - General dependency upgrade
- New demo at Codesandbox
Breaking changes
express@4
is now a peerDependency, please install it asdependencies
on your app- By default, the SSR renderer will be node stream instead of string, which will support full Suspense features
v4.5.0
- TypeScript support
v4.4.0
- SVG support using SVGR, credits to @dmitry-zaets
v4.3.2
- Use preserve-symlinks to solve React singleton issue (internal only, improve DX for contributor)
- String rendered: return 500 when the renderer has failed (#198)
- Use max-age=31536000 and immutable in Cache-Control (#177) (#182)
- Update react-scripts in group default to the latest version 🚀 (#175)
- Update babel7 in group default to the latest version 🚀 (#173)
Patch Release 2019
v4.1.0
- Fix error not logged when running build
- Added new babel plugin: "@babel/plugin-proposal-class-properties"
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
v3.2.4
- Fixed bug where you cannot import external css files (from node_modules)