react-snap pre-renders single-page apps into static HTML by crawling links with Headless Chrome. It targets SEO and social sharing without framework-specific server rendering.
Overview
react-snap walks client-side routes starting at the entry URL and writes HTML snapshots suitable for search engines and link previews. It uses a real browser engine, so modern DOM APIs used in the app remain available during capture.
Configuration stays minimal for create-react-app, Preact, and Vue projects by adjusting build scripts and entry hydration. Optional settings cover inline CSS experiments, caching AJAX responses, blocking third-party requests, and Puppeteer launch flags for containers.
The tool framework-agnostic despite the name; Vue and Preact integrations document hydration caveats such as data-server-rendered markers or replace flags. Service worker setups should serve a separate 200.html fallback to avoid flashing the home snapshot on other routes.
Caveats include reliance on HTML5 history routing, async component flashing unless additional loaders are used, and limited Redux state serialization to JSON-safe values.
Key features
- Headless Chrome site crawl
- Static HTML output for SPAs
- Create React App integration
- Vue and Preact usage notes
- Optional AJAX response cache
- Third-party request blocking
- Puppeteer troubleshooting options
- Fork-friendly npm package layout
Use cases
- SEO for client-rendered React sites
- Social preview cards for SPAs
- Static hosting without SSR servers
- Marketing sites built with Vue or Preact
- Improving first paint on cheap hosting