index.html should be in the /public folder #15139
ivanjeremic
started this conversation in
Feedback
Replies: 1 comment
-
Use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Belive it or not there are people building traditional websites with anchor tags and use the web as router then put this on an webserver via ftp/cpanel, And even if they don't, the correct way would be to move the
index.html
which we get at the root of our project withnpm create vite
inside the public folder which would be more correct and allow people to also build websites in a traditional way but still with a buildtool like vite.The advantage is that you can do:
then build and deploy on a webserver.
keeping the
index.html
at the root of a vite project makes not really sense in the sense of how the web file-system works. We already have the public folder so why not use it for theindex.html
which in the end will be "public" to the web anyways, that's how the/public
folder was meant to be used in frameworks anyways and past frameworks/boilerplates used it already correctly but it seems that the meaning of the/public
folder got lost somewhere recently. @yyx990803I know that MPA Mode exists and it does not solve the issue, if you have 20 pages and 5 have no JavaScript and are just static they will not get bundled and moved to the
/dist
folder together with the other pages. Also it does not change the fact thatindex.html
belongs to the/public
folder.What we also need for this is that the dev server behaves like a LiveServer do navigating to folder which have an index.html reloves and works without needing the file extension.
Beta Was this translation helpful? Give feedback.
All reactions