Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run vite server if index.html file is not in the root directory

enter image description here

  • Index.html & app.css is outside of the /tailwindcss/...
  • Vite Server is running but not working on localhost.

How to fix this problem

I don't want to put index.html in directory tailwindcss.

like image 971
Abhay Pratap Rana Avatar asked Dec 18 '25 02:12

Abhay Pratap Rana


1 Answers

Vite looks for a root index.html by default. You can change this behaviour in package.json.

To do this, simply modify the following to suit...

"scripts": {
  "dev": "vite serve ./src"
},

In this example, I've put my entry index.html file inside a src folder. I tell Vite about this via serve, following that with the relevant directory (file path is relative to project root).

Read more here.

like image 135
marktripney Avatar answered Dec 20 '25 16:12

marktripney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!