Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hypervenom1404's avatar

Blank Screen on production server using Inertiajs and React

The website works fine in local server but when I host it on production server, I get a white page and a few assets not found on the networks tab. ( I have tried Cpanel and Railway )

0 likes
20 replies
martinbean's avatar

@hypervenom1404 It doesn’t matter if it’s “working just fine on local server”. It’s not working on your production server.

So, fix the not found errors that you are getting in production and not locally. If you need further help, then it would help us to help you if you could show what files are returning a not found response.

Unfortunately, we can’t see your screen, nor are we clairvoyant.

hypervenom1404's avatar

@martinbean when I run the build command all modules that the missing on the server are being transformed and included in the build file. It's just when I upload it on cpanel the screen turns white and it shows a 404 error

martinbean's avatar

@hypervenom1404 That screenshot is useless as you’ve truncated every column, and still not showing any actual error messages.

martinbean's avatar

@hypervenom1404 Are you actually running npm run build when deploying to Railway then? Because it doesn’t look like you are if all of your built assets are 404-ing.

hypervenom1404's avatar

@martinbean I am, I have it on my server logs aswell and with Cpanel I am uploading everything after running the build command. It is not working both ways.

shariff's avatar

@hypervenom1404 If you have build your project using npm run build Try giving the actual file path using asset('path to your js or css file') instead of @vite(['resources/css/app.css', 'resources/js/app.js'])

hypervenom1404's avatar

@shariff

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title inertia>{{ config('app.name', 'Laravel') }}</title>
        <!-- Fonts -->
        <link rel="preconnect" href="https://fonts.bunny.net">
        <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />

        <!-- Scripts -->
        @routes
        @viteReactRefresh
        @vite(['resources/css/app.css', 'resources/js/app.jsx'])
        @inertiaHead
    </head>
    <body class="font-sans antialiased">
        @inertia
    </body>
</html>

hypervenom1404's avatar
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import react from "@vitejs/plugin-react";

export default defineConfig({
   plugins: [
      laravel({
        input: [
            'resources/css/app.css',
            'resources/js/app.jsx',
        ],
         refresh: true,
      }),
      react(),
   ],
   build: {
      chunkSizeWarningLimit: 2000,
   },
});

Please or to participate in this conversation.