<?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: YOUNARES</title>
    <description>The latest articles on DEV Community by YOUNARES (@younares).</description>
    <link>https://dev.to/younares</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%2F4260321%2F2db39060-efdc-47e6-9eca-0a0becf1e347.jpg</url>
      <title>DEV Community: YOUNARES</title>
      <link>https://dev.to/younares</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/younares"/>
    <language>en</language>
    <item>
      <title>Vite app shows a blank page after deploying? Check these 6 things</title>
      <dc:creator>YOUNARES</dc:creator>
      <pubDate>Mon, 23 Nov 2026 10:34:43 +0000</pubDate>
      <link>https://dev.to/younares/vite-app-shows-a-blank-page-after-deploying-check-these-6-things-o99</link>
      <guid>https://dev.to/younares/vite-app-shows-a-blank-page-after-deploying-check-these-6-things-o99</guid>
      <description>&lt;p&gt;Your React + Vite app works perfectly on localhost. You deploy it, and you get a white screen, missing assets, or a 404 when you refresh a page.&lt;/p&gt;

&lt;p&gt;Before you start changing random config files and redeploying over and over, go through these checks in order.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Open the browser console and network tab first
&lt;/h2&gt;

&lt;p&gt;A blank page almost always has an error behind it. A red error in the &lt;strong&gt;Console&lt;/strong&gt;, or a failed request in the &lt;strong&gt;Network&lt;/strong&gt; tab (for example a 404 on a JS or CSS file), tells you which of the steps below to focus on.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Check your &lt;code&gt;base&lt;/code&gt; setting
&lt;/h2&gt;

&lt;p&gt;If your site is served from a subpath (like &lt;code&gt;username.github.io/my-app/&lt;/code&gt;), assets will 404 unless &lt;code&gt;base&lt;/code&gt; is set in &lt;code&gt;vite.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'/my-app/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you deploy to a root domain, &lt;code&gt;base&lt;/code&gt; should be &lt;code&gt;'/'&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Fix the 404 when you refresh a route
&lt;/h2&gt;

&lt;p&gt;React Router handles routes in the browser, but the server doesn't know them. So refreshing &lt;code&gt;/about&lt;/code&gt; returns a 404. You need a fallback to &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On Vercel&lt;/strong&gt;, add a &lt;code&gt;vercel.json&lt;/code&gt;:&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="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"rewrites"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"source"&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="nl"&gt;"destination"&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="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;On Cloudflare Pages&lt;/strong&gt;, add a &lt;code&gt;public/_redirects&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*  /index.html  200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Check your environment variables
&lt;/h2&gt;

&lt;p&gt;Three common mistakes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client-side variables in Vite must start with &lt;code&gt;VITE_&lt;/code&gt;, and you read them with &lt;code&gt;import.meta.env.VITE_YOUR_KEY&lt;/code&gt;, not &lt;code&gt;process.env&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Variables must be set in your host's dashboard (Vercel, Cloudflare), not only in your local &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;They are baked in at &lt;strong&gt;build time&lt;/strong&gt;, so after adding or changing one you need to redeploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Watch out for case-sensitive file names
&lt;/h2&gt;

&lt;p&gt;Windows and macOS often ignore letter case, but Linux build servers don't. This works locally and fails in production if the file is actually named &lt;code&gt;Header.jsx&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Header&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./header'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Confirm your build settings and project root
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Build command: &lt;code&gt;npm run build&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Output directory: &lt;code&gt;dist&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If your app lives in a subfolder (a monorepo, for example), set the correct &lt;strong&gt;root directory&lt;/strong&gt; in your host settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Still stuck?
&lt;/h2&gt;

&lt;p&gt;I put all of this into a free field guide. It includes a 10-minute deployment triage, a diagnostic decision tree, an incident worksheet and a pre-deployment checklist, with checks for Vercel and Cloudflare Pages.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://younares.gumroad.com/l/ReactDeploymentRescueKit" rel="noopener noreferrer"&gt;Get the free React Deployment Rescue Kit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If one of these fixed your blank page, let me know in the comments. And if it's something else, share your error message and I'll help you narrow it down.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>vite</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
