Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change path index.html #91

Closed
pitsanujiw opened this issue May 8, 2020 · 4 comments
Closed

change path index.html #91

pitsanujiw opened this issue May 8, 2020 · 4 comments

Comments

@pitsanujiw
Copy link

pitsanujiw commented May 8, 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.

@yyx990803
Copy link
Member

yyx990803 commented May 8, 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.

@Danzo7
Copy link

Danzo7 commented May 11, 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

@leohxj
Copy link

leohxj commented May 28, 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

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants