Skip to content

Commit 9dcc493

Browse files
authored
Add React 18 support (#25)
* feat: support React18 * test: react 18 exported bundle * doc: update react18 notation
1 parent e7e1213 commit 9dcc493

File tree

7 files changed

+4816
-25
lines changed

7 files changed

+4816
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The crate aims to enable server side rendering on rust servers in the simplest a
77

88
It uses an embedded version of the [V8](https://v8.dev/) javascript engine (<a href="https://github.com/denoland/rusty_v8" target="_blank">rusty_v8</a>) to parse and evaluate a built bundle file and return a string with the rendered html.
99

10-
Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 17](https://react.dev/) - Check the examples folder.
10+
Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 18](https://react.dev/) - Check the examples folder.
1111

1212
> Check <a href="https://github.com/Valerioageno/ssr-rs/blob/main/benches">here</a> the benchmark results.
1313

examples/vite-react/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"preview": "vite preview"
1212
},
1313
"dependencies": {
14-
"react": "^17.0.2",
15-
"react-dom": "^17.0.2"
14+
"fast-text-encoding": "^1.0.6",
15+
"react": "^18.2.0",
16+
"react-dom": "^18.2.0"
1617
},
1718
"devDependencies": {
1819
"@rollup/plugin-node-resolve": "^15.2.3",

examples/vite-react/pnpm-lock.yaml

Lines changed: 20 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/vite-react/src/server-entry.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "fast-text-encoding"; // Mandatory for React18
12
import { renderToString } from "react-dom/server";
23
import App from "./App";
34

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! It uses an embedded version of the [V8](https://v8.dev/) javascript engine (<a href="https://github.com/denoland/rusty_v8" target="_blank">rusty_v8</a>) to parse and evaluate a built bundle file and return a string with the rendered html.
77
//!
8-
//! Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 17](https://react.dev/) - Check the examples folder.
8+
//! Currently it works with latest [Vite](https://vitejs.dev/), latest [Webpack](https://webpack.js.org/) and [React 18](https://react.dev/) - Check the examples folder.
99
//!
1010
//! > Check <a href="https://github.com/Valerioageno/ssr-rs/blob/main/benches">here</a> the
1111
//! benchmarks results.

0 commit comments

Comments
 (0)