Closed laminesadiki closed 11 months ago
I'm working in React project using Vite and React-Router.
I setup multiple pages using react router like this example
<BrowserRouter> <Routes> <Route path="/" element={<Home />} /> <Route path="/login" element={<Login />} /> </Routes> </BrowserRouter>
When I build the application using tsc && vite build and serving the application via serve dist.
tsc && vite build
serve dist
The main page works correctly but the/login path don't working; Give me a 404 error.
/login
Can anyone suggest a solution for this situation ?
14.2.1
18.18.1
I find a solution is running the with -s flag like dist serve -s dist
serve -s dist
Description
I'm working in React project using Vite and React-Router.
I setup multiple pages using react router like this example
When I build the application using
tsc && vite build
and serving the application viaserve dist
.The main page works correctly but the
/login
path don't working; Give me a 404 error.Can anyone suggest a solution for this situation ?
Library version
14.2.1
Node version
18.18.1