Subscribe on changes!

change path index.html

avatar
May 8th 2020

Heya! Now, I used vite, that's good, however, I would like to change path first index.html to any path, any folder by not referring to any dependencies.

---public
        ---- index.html
---src
       ---- main.ts
       ---- app.vue

Thanks.

avatar
May 8th 2020

In vite, index.html is part of your source code. Vite parses/rewrites it during dev and also transforms it in build. Don't put it separate from your source code.

vite also in general do not accommodate any preference based options - if there is no real technical reason to add an option, then it will not be considered.

avatar
May 11th 2021

In vite, index.html is part of your source code. Vite parses/rewrites it during dev and also transforms it in build. Don't put it separate from your source code.

vite also in general do not accommodate any preference based options - if there is no real technical reason to add an option, then it will not be considered.

I believe that adding a mount option like snowpack will help in organizing as for me I prefer to have public for static html and robot.txt files and src for app core and many does as it more like a standard

avatar
May 28th 2021

You can manual add public folder, but vite will not parse it. I add below to my custom.html:

in header:

<script type="module" src="/@vite/client"></script>
  <script type="module">
import RefreshRuntime from "/@react-refresh"
RefreshRuntime.injectIntoGlobalHook(window)
window.$RefreshReg$ = () => {}
window.$RefreshSig$ = () => (type) => type
window.__vite_plugin_react_preamble_installed__ = true
</script>

in body:

<div id="root"></div>
    <script type="module" src="/src/main.tsx"></script>

then visit http://localhost:3000/public/custom.html

avatar
Jul 16th 2021

This issue has been locked since it has been closed for more than 14 days.

If you have found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Vite version. If you have any other comments you should join the chat at Vite Land or create a new discussion.