How do i make VueJs with Vite to work in production?

  Kiến thức lập trình

Hello my VueJs app with vite runs okay in development environment when using npm run dev. But when I try to run exactly the same code(same env variables and server) but using vite build or npm build to create a dist, and then serve -s dist in the same localhost and port, something is not working okay and it is only rendering like the main index.html file. I use also a router for client endpoints, ¿what could be the problem?