<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vijay Rathod</title>
    <description>The latest articles on DEV Community by Vijay Rathod (@vijay_rathod_b9db92cb65f8).</description>
    <link>https://dev.to/vijay_rathod_b9db92cb65f8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4026494%2F0c8ccfea-74b6-42d7-959c-884fb45efb74.jpg</url>
      <title>DEV Community: Vijay Rathod</title>
      <link>https://dev.to/vijay_rathod_b9db92cb65f8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vijay_rathod_b9db92cb65f8"/>
    <language>en</language>
    <item>
      <title>Pre-rendering a 160-post React SPA with react-snap: the gotcha that silently breaks your SEO</title>
      <dc:creator>Vijay Rathod</dc:creator>
      <pubDate>Sun, 12 Jul 2026 23:49:06 +0000</pubDate>
      <link>https://dev.to/vijay_rathod_b9db92cb65f8/pre-rendering-a-160-post-react-spa-with-react-snap-the-gotcha-that-silently-breaks-your-seo-3ino</link>
      <guid>https://dev.to/vijay_rathod_b9db92cb65f8/pre-rendering-a-160-post-react-spa-with-react-snap-the-gotcha-that-silently-breaks-your-seo-3ino</guid>
      <description>&lt;p&gt;We ship a React SPA with about 160 blog posts and a handful of core routes, and rely on &lt;code&gt;react-snap&lt;/code&gt; in the &lt;code&gt;postbuild&lt;/code&gt; step to pre-render everything to static HTML for crawlers. It's a solid, low-maintenance setup — until it silently fails and you don't notice for days.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;react-snap&lt;/code&gt; drives a real headless Chrome instance (via Puppeteer) against your build output, crawling every route in an &lt;code&gt;include&lt;/code&gt; list and writing the rendered HTML back to disk. Our config looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"reactSnap"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"crawl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"puppeteerExecutablePath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"concurrency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"saveAs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"include"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/blog"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note &lt;code&gt;puppeteerExecutablePath&lt;/code&gt; — we point it at the system-installed Google Chrome instead of the bundled Chromium, mainly to avoid re-downloading a browser binary in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  The gotcha
&lt;/h2&gt;

&lt;p&gt;That one line is also the trap. If your actual desktop Google Chrome is open — especially with a lot of tabs — &lt;code&gt;react-snap&lt;/code&gt; has to share system memory with it. On a ~168-route crawl, we started seeing the process get SIGKILLed (&lt;code&gt;exit 137&lt;/code&gt;) partway through, consistently somewhere around route 45–59.&lt;/p&gt;

&lt;p&gt;Here's the dangerous part: the webpack build step &lt;em&gt;before&lt;/em&gt; &lt;code&gt;postbuild&lt;/code&gt; still exits 0. So your CI/CD or local &lt;code&gt;npm run build&lt;/code&gt; looks completely successful. What actually happened is &lt;code&gt;react-snap&lt;/code&gt; died halfway through crawling, and every route it didn't reach got written out as the raw client-side-rendered shell — an empty &lt;code&gt;&amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt; with no server-rendered content for crawlers to read.&lt;/p&gt;

&lt;p&gt;We deployed exactly this once: build "succeeded," but roughly two-thirds of our blog posts and even the homepage went out as empty shells. Nothing in the deploy pipeline flagged it. The first signal was indexing quality dropping.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we do now, every deploy
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fully quit Chrome before building.&lt;/strong&gt; Not just close windows — &lt;code&gt;osascript -e 'quit app "Google Chrome"'&lt;/code&gt; (macOS), and if a "save tabs?" dialog blocks it, &lt;code&gt;pkill -9 -f "Google Chrome"&lt;/code&gt;. Tabs restore fine on reopen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the crawl count in the build log.&lt;/strong&gt; It should say &lt;code&gt;crawled 168 out of 168&lt;/code&gt; (or whatever your total route count is). Anything less, or an &lt;code&gt;exit 137&lt;/code&gt;, means the build is not safe to deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grep the output for real content&lt;/strong&gt;, not just file existence:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-oc&lt;/span&gt; &lt;span class="s2"&gt;"Your Homepage H1 Text"&lt;/span&gt; build/index.html   &lt;span class="c"&gt;# should be &amp;gt;=1&lt;/span&gt;
&lt;span class="nb"&gt;ls &lt;/span&gt;build/blog/post/ | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;                          &lt;span class="c"&gt;# should match your post count&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Never re-run &lt;code&gt;react-snap&lt;/code&gt; on an existing &lt;code&gt;build/&lt;/code&gt; directory.&lt;/strong&gt; It drops a &lt;code&gt;200.html&lt;/code&gt; marker file and will refuse with "can not run react-snap twice." Always start from a fresh &lt;code&gt;npm run build&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why this matters more than it looks
&lt;/h2&gt;

&lt;p&gt;A CSR shell isn't a 404 — it's a 200 with valid (if minimal) HTML. Nothing in a typical deploy pipeline treats that as a failure. Search engines and ad reviewers, on the other hand, absolutely notice: an empty shell reads as thin or fabricated content, which is exactly the kind of thing that gets a site flagged for low-value content — not a ranking penalty you get an obvious warning for.&lt;/p&gt;

&lt;p&gt;If you're running &lt;code&gt;react-snap&lt;/code&gt; (or any Puppeteer-based prerenderer) against a system browser install rather than a bundled/managed one, treat "is the browser actually free of other load" as a real precondition, and add a content-count assertion as a real gate before you ship — not just a green build.&lt;/p&gt;




&lt;p&gt;We run this pipeline for &lt;a href="https://chatrio.app" rel="noopener noreferrer"&gt;Chatrio&lt;/a&gt;, a small anonymous chat app with a ~160-post SEO content layer sitting on top of it.&lt;/p&gt;

</description>
      <category>react</category>
      <category>seo</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
