Subscribe on changes!

After Build Error When Serving index.html ( Windows )

avatar
May 7th 2020

Describe the bug

After Building App I Tried To Serve index.html But It Fail Due To Windows Path Problem.

index.html

<link rel="stylesheet" href="/assets/style.css">
<div id="app"></div>


<script type="module" src="/assets/index.js"></script>

I Tried To Fix It. Both Of This Are Solution Of This Bug.

<link rel="stylesheet" href="assets/style.css">
<div id="app"></div>


<script type="module" src="assets/index.js"></script>
----------------------------------------------------------------------------------------
<link rel="stylesheet" href="./assets/style.css">
<div id="app"></div>


<script type="module" src="./assets/index.js"></script>

I Added A PR(#63) To Fix This But It Was Rejected

System Info

  • vite version: 0.11.3
  • Operating System: Windows 10
  • Node version: 14.2
avatar
May 7th 2020

This is not a Windows path problem, the generated asset paths are intentionally always absolute paths so that it can work when deployed to a server with SPA index fallback. You need to serve the dist folder with an http server.