On my local server, using npm run dev, I can see the react routes without a problem. But on my production server, when I want to access the routes, this problem appears. enter image description here
My vite.config.js
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.jsx',
refresh: true,
}),
react(),
],
});
My app.jsx file
createInertiaApp({ title: (title) => ${title} - ${appName}, resolve: async (name) => resolvePageComponent( ./pages/${name}.jsx`,
import.meta.glob("./pages/**/*.jsx")
),setup({ el, App, props }) {
const currentPath = window.location.pathname;
let selectedLayout;
// Ejemplo de condición para seleccionar el layout basado en la ruta
if (currentPath.startsWith("/constructor") || currentPath.startsWith("/comentarios")) {
selectedLayout = <ConstructorLayout>{/* Puedes añadir props específicas aquí */}</ConstructorLayout>;
createRoot(el).render(
React.cloneElement(selectedLayout, null, <App {...props} />)
);
}else{
createRoot(el).render(
<App {...props} />
);
}
},`