The issue might be related to the asset URLs not being generated correctly in production. One solution could be to update the laravel-vite-plugin configuration to use the correct public path for the assets.
Try updating the laravel-vite-plugin configuration to include the publicPath option:
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [
laravel({
input: "resources/js/app.jsx",
refresh: true,
publicPath: "/public/", // update this to the correct public path
}),
react(),
],
build: {
chunkSizeWarningLimit: 1000,
},
});
Make sure to replace /public/ with the correct public path for your application.
If this doesn't work, try checking the network tab in the browser's developer tools to see if the assets are being loaded correctly and if there are any errors.