Hi everyone I’m creating my own project with React, using Wouter as a router tool alternative from react-router-dom.
This is my website: https://shop-app-javi.netlify.app/
I have noticed that when I try to preview my project in production from my machine I can access to my components view from navbar without any problem.
Althought when I publish my app to Netlify I got 404 error for each item of my menu.
These are my routes, perhaps anybody could help me to understand the problem, as far as I know I’ve created redirects file to look for the content of those items whenever user refresh browser.
These are my files
Header.jsx
<ul className="mobile:hidden flex justify-evenly items-center w-[400px] mx-auto">
<li>
<a href="/products" title="products" className="hover:underline hover:decoration-[#ff6f7b]">
<h3 className="text-[#ff6f7b] text-base font-bold">Products</h3>
</a>
</li>
</ul>
vite.config.jsx
{
find: '@features',
replacement: path.resolve(path.join(__dirname, '/src/features')),
}
App.jsx
import Header from "@features/Header/Header.jsx"
import {Route} from "wouter";
const Products = lazy(() => import("@features/Products/Products.jsx"));
return (
<>
<Header/>
<Suspense fallback={<div className="lds-circle py-[50px]"><div></div></div>}>
<Route path="/products" component={Products}></Route>
</Suspense>
</>