@hypervenom1404 Well you need to fix those not found errors.
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 )
@martinbean They are working just fine on local server. I am unable to catch the issue
@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.
@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
@hypervenom1404 Have you verified that your code is free from the Case-Sensitive issue?
@DhPandya I guess so, I started the project with breeze setup
@hypervenom1404 And again, show the actual errors.
@hypervenom1404 That screenshot is useless as you’ve truncated every column, and still not showing any actual error messages.
@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.
@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.
@hypervenom1404 Which version of laravel you are using? Are you using vite or webpack?
@shariff "vite": "^4.0.0"
@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'])
@shariff same as before
@hypervenom1404 Can you show how you are linking the js and css file
<!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>
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,
},
});
It might be some issue with railways I deployed my own nginx server and it works fine. Thanks for helping guys! @martinbean @dhpandya @shariff
Please or to participate in this conversation.