-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Option to place nested index.html
entry point at the root of the output directory
#19493
Comments
@sapphi-red I could try to implement a solution and submit a PR if you tell me what your vision for the feature is. Should it be implemented as a build option like Sorry about not using a template for this issue by the way, it was an accident. |
We avoid adding options that are possible to achieve with other options. https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md#think-before-adding-yet-another-option |
@sapphi-red is there any use in having the original location of |
I believe many people are doing so because it's the way written in the docs. Introducing a breaking change also requires a reason. It may be useful for your case, but I'm not sure whether it is for others cases. If you organize the possible use cases and prove it is generally useful, then we can consider changing it. Without that, keeping the current behavior feels more beneficial to me. |
@sapphi-red oh I see, supporting multiple entry points is actually a good reason to have this behavior, and differentiating between cases would make everything unnecessarily complicated. |
This setup puts the
index.html
file intodist/client/client
instead ofdist/client
so that in the output directory, the file's placement relative to the project's root is mimicked. Now, when running the dev server,index.html
is only served at/client/
, and not at/
as I would expect.By contrast, with the following setup, the bundled copy of the
.js
entry point is placed at the root of the output directory (dist/server
) as expected:Here is a small demonstration: https://stackblitz.com/edit/vite-index-html-in-subdir
An obvious solution to the problem is to set
root: 'client'
, but why should that be necessary?It all probably works as intended, but having at least an option to place
index.html
at the root of the output directory would be very nice.Related: https://stackoverflow.com/a/72326219/9861000
The text was updated successfully, but these errors were encountered: