Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.1K
Views
Vercel + Vite - 404 not found

I am developping a website with vite which seem work like it should on localhost.
I deployed on Vercel and the site was build without errors.
But I discovered a big problem when I wanted to generate my sourcemaps. In fact, when I want to visit any page directly (.../about for example) vercel sends me a "404 not found" error. But when I go to the root page and navigate to the page manually everything is working. Second time i visit the /about page directly, it works, but because it has been cached by my browser i think ...

hosting : vercel
base url: https://dev.energie-etre-ange.fr
404 example url : https://dev.energie-etre-ange.fr/about

used plugins :

  • vite-plugin-pages
  • vue-router (v4)
  • vite-ssg

I can give the github link if needed, but i think this is mostly a vercel problem ? I found a linked problem on stackoverflow, but with React (link)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Answer found here : https://stackoverflow.com/a/66686684/13541914
Credit goes to shantiscrip

Solution:
This is not a problem with vite.js but due to with a missing configuration file for vercel which is added by default to the existing templates. For a single page application the html files for the routes created with react router don't exist, so something on the server needs to create rewrites to make sure every request points at '/' or index.html. In Vercel this can be done by adding a rewrite to config file in the root of the project called

vercel.json
https://vercel.com/docs/configuration
Add rewrites for all routes to the file that point to '/'

{
  "rewrites": [{ "source": "/(.*)", "destination": "/" }]
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!