Skip to content

Commit

Permalink
Add React 18 support (#25)
Browse files Browse the repository at this point in the history
* feat: support React18

* test: react 18 exported bundle

* doc: update react18 notation
  • Loading branch information
Valerioageno authored Mar 9, 2024
1 parent e7e1213 commit 9dcc493
Show file tree
Hide file tree
Showing 7 changed files with 4,816 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The crate aims to enable server side rendering on rust servers in the simplest a

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.

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.
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.

> Check <a href="https://github.com/Valerioageno/ssr-rs/blob/main/benches">here</a> the benchmark results.
Expand Down
5 changes: 3 additions & 2 deletions examples/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"preview": "vite preview"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
"fast-text-encoding": "^1.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
Expand Down
41 changes: 20 additions & 21 deletions examples/vite-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/vite-react/src/server-entry.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "fast-text-encoding"; // Mandatory for React18
import { renderToString } from "react-dom/server";
import App from "./App";

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! 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.
//!
//! 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.
//! 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.
//!
//! > Check <a href="https://github.com/Valerioageno/ssr-rs/blob/main/benches">here</a> the
//! benchmarks results.
Expand Down
Loading

0 comments on commit 9dcc493

Please sign in to comment.