I added this on my vite.config.js.

import { defineConfig } from 'vite';

export default defineConfig({
  base: './'
});

It happens becouse our navigator doesnt recognize the path /heres-the-file-or-paths so i needed to add the ./ at the beginning of our path when are importing .js and .css files. The same for icons and others.

This makes that the build process ends with and index.html like this with our imports paths working. href="./the-rest-of-the-path-here"

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="icon" type="image/svg+xml" href="./vite.svg" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Vite + React</title>
        <script type="module" crossorigin src="./assets/index.b3824f6c.js"></script>
        <link rel="stylesheet" href="./assets/index.3fce1f81.css">
    </head>
    <body>
        <div id="root"></div>
        
    </body>
</html>

I hope this can help you.

Answer from Joel Orzet on Stack Overflow
Discussions

`vite preview` does not start server
Describe the bug When I run npx vite build && npx vite preview, the server is not started. It seems like npx vite preview just exists, without any output. I have created as small a reproduc... More on github.com
🌐 github.com
3
January 29, 2024
'Cannot get /' on a TanStack Start project in vite preview mode
Which project does this relate to? Start Describe the bug I've create a Start project with pnpm create @tanstack/start@latest. I have not touched the code, I'm just installing the dependenc... More on github.com
🌐 github.com
25
October 13, 2025
vite preview does not work
Describe the bug Hi all. I was migrating from CRA to Vite, and ran into a white screen issue after building and running the vite preview. However, in dev mode everything works fine. Due to the abse... More on github.com
🌐 github.com
7
June 8, 2023
Within a dev container using Docker 26, `vite dev` or `vite preview` cannot be accessed from the host
Describe the bug I initialy though this was a case of #11468 (comment), but it seems it is something else, so I am opening another issue. Using Dev Containers for development, and after upgrading t... More on github.com
🌐 github.com
32
April 24, 2024
🌐
Reddit
reddit.com › r/vuejs › vite build not working but not providing any errors. vite preview works fine.
r/vuejs on Reddit: Vite build not working but not providing any errors. vite preview works fine.
January 3, 2024 -

I'm having an issue where both vite dev and vite preview are working as expected. When I do a vite build everything seems fine, all my bundles are properly created and referenced properly. I see no errors when I attempt to view the page using live server but get just a blank page.

I'm using vuetify 3 with page routing and a pinia store but it's a pretty simple app and using the default vite.config.js settings.

Has anyone else experienced this issue? Any idea how I can even troubleshoot if I'm not seeing any errors in console?

🌐
Vite
vite.dev › guide › troubleshooting
Troubleshooting | Vite
You will need to access the file with http protocol. The easiest way to achieve this is to run npx vite preview.
🌐
GitHub
github.com › vitejs › vite › issues › 15743
`vite preview` does not start server · Issue #15743 · vitejs/vite
January 29, 2024 - Describe the bug When I run npx vite build && npx vite preview, the server is not started. It seems like npx vite preview just exists, without any output. I have created as small a reproduc...
Author   Stadly
🌐
GitHub
github.com › TanStack › router › issues › 5462
'Cannot get /' on a TanStack Start project in vite preview mode · Issue #202 · TanStack/create-tsrouter-app
October 13, 2025 - I've create a Start project with pnpm create @tanstack/start@latest. I have not touched the code, I'm just installing the dependencies and launching the project. Dev version works ok, but when I try to build and preview the production build, I get Cannot GET /:
Author   netimen
🌐
GitHub
github.com › vitejs › vite-plugin-react › issues › 176
vite preview does not work · Issue #176 · vitejs/vite-plugin-react
June 8, 2023 - Describe the bug Hi all. I was migrating from CRA to Vite, and ran into a white screen issue after building and running the vite preview. However, in dev mode everything works fine. Due to the absence of any error in the console, I had t...
Author   emargin
🌐
GitHub
github.com › vitejs › vite › issues › 16522
Within a dev container using Docker 26, `vite dev` or `vite preview` cannot be accessed from the host · Issue #16522 · vitejs/vite
April 24, 2024 - Using Dev Containers for development, and after upgrading to Docker 26 (from 25) on the host, I am unable to connect to either vite dev or vite preview server using the default and basic port forwarding feature of the dev containers. By "unable to connect", I mean that the server is launched, however when trying to connect from my host using http://localhost:4200/, either Chromium or Firefox Dev Edition request hangs indefinitely on loading (it stays in loading state without timing out for at least for a good 5-10 minutes; didn't test longer than that). I am using Nx, but using vite directly does not change the outcome.
Author   sharky98
Find elsewhere
🌐
GitHub
github.com › vitejs › vite › discussions › 8149
Vite Preview doesn't quite work with React · vitejs/vite · Discussion #8149
When using npx vite preview dist/ the browser doesn't even do anything, just prints: Cannot GET /
Author   vitejs
🌐
GitHub
github.com › vitejs › vite › issues › 9091
vite preview cmd fails using build lib in config · Issue #9091 · vitejs/vite
July 13, 2022 - Describe the bug vite build's sucessfully but when trying to preview with vite preview demo page shows a Cannot GET / Perhaps previewing isn't compatible with build.lib?, please let me know if this is the case. Also the vite build comman...
Published   Jul 13, 2022
🌐
Reddit
reddit.com › r/reactjs › vite preview without code obfuscation
r/reactjs on Reddit: Vite preview without code obfuscation
November 13, 2025 -

I have a problem that only shows up in production. When I attempt to track the problem down using Chrome Dev Tools it is hard for me because all the code has been mashed together and obfuscated by Vite (or Rollup or whatever.)

Is there any way to build my app for production without all the crazy camouflage?

🌐
GitHub
github.com › vitejs › vite › discussions › 14198
Build preview - app does not update on state changes · vitejs/vite · Discussion #14198
When I change update ScreenState model with new item property in DatX store from another component - the component with computed getter does not rerender. That happens only in production build, in dev server, the component rerenders right after ScreenStete item is updated in store. Beta Was this translation helpful? Give feedback. ... There was an error while loading. Please reload this page. Something went wrong. There was an error while loading. Please reload this page. ... I understand that you cannot share the repo.
Author   vitejs
🌐
GitHub
github.com › vitejs › vite › discussions › 2834
Why is it not recommended to use `vite preview` in production? · vitejs/vite · Discussion #2834
Please don't use Vite preview in production. It is not in the scope of Vite to provide a robust solution for a production server. Vite Preview uses sirv internally. At this point it is not using it in dev mode, but we may decide to change that ...
Author   vitejs
🌐
Vite
v3.vite.dev › config › preview-options
Preview Options | Vite
Configure CORS for the preview server. This is enabled by default and allows any origin.