React on the Edge
This example is for framework builders and advanced usage of the low-level Vercel Build Output API. If you’re looking to develop a React application with dynamic Edge capabilities, we recommend Next.js Middleware and Vercel Edge Functions.
How to use
pnpm i then:
- To build:
- To run a local server:
To build this demo with streaming (
renderToStream) instead of
USE_STREAMS=1 pnpm build.
.vercel/output will be created which you can deploy via
util/build.mjsimplements the build process on top of
src/appinto an Edge Function.
util/start.mjsimplements a local server using the
edge-runtimepackage that can locally run the build outputs.
Due to the absence of a dev server,
watchexec can be used as a replacement. Use
brew install watchexec to install.
watchexec -c -r --no-meta 'node util/build.mjs; node util/start.mjs'