https://github.com/sudo-self/react-edge
https://github.com/sudo-self/react-edge
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/sudo-self/react-edge
- Owner: sudo-self
- Created: 2023-11-16T06:51:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-26T05:48:12.000Z (over 2 years ago)
- Last Synced: 2025-01-24T14:46:51.822Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://react-edge-seven.vercel.app
- Size: 186 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# React on the Edge
[`sveltekit-on-the-edge`](https://sveltekit-on-the-edge.vercel.app/) but on top of React. It uses `esbuild` for bundling and [Vercel Edge Functions](https://vercel.com/edge) for SSR.
Run `pnpm i` then:
- To build: `pnpm build`
- To run a local server: `pnpm start`
To build this demo with streaming (`renderToStream`) instead of `renderToString` run `USE_STREAMS=1 pnpm build`.
After building, `.vercel/output` will be created which you can deploy via `vc --prebuilt`.
- `util/build.mjs` implements the build process on top of `esbuild` that bundles `src/app` into an Edge Function.
- `util/start.mjs` implements a local server using the `edge-runtime` package that can locally run the build outputs.
Due to the absence of a dev server, [`watchexec`](https://github.com/watchexec/watchexec) can be used as a replacement. Use `brew install watchexec` to install.
```bash
watchexec -c -r --no-meta 'node util/build.mjs; node util/start.mjs'
```