-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Provide path option and apply transform for index.html #528
Comments
You can actually use a custom server plugin to serve whatever HTML you want: createServer({
configureServer: ({ app }) => app.use(async (ctx, next) => {
// wait for vite history fallback
// this redirects all valid paths to `index.html`
await next()
if (ctx.url.endsWith('.html')) {
ctx.body = ... // serve whatever html you want or transform ctx.body (if exists)
ctx.status = 200
}
})
}) |
Thanks for the suggestion @yyx990803. I got it working for development, but https://github.com/vitejs/vite/blob/master/src/node/build/index.ts#L268 |
Another related thing that would be really nice is to be able to have |
Is your feature request related to a problem? Please describe.
I'm trying to integrate Vite into a framework. The rigid
index.html
unfortunately makes this impossible.The framework itself needs to transform
index.html
while 3rd part integrations require hacks to work withindex.html
in the project root.Describe the solution you'd like
Providing a path option for
index.html
and apply transforms during build.Describe alternatives you've considered
I tried centering the framework around Vite's
index.html
convention, but had to give up as it broke compatibility with other integrations.Additional context
Hardcoding file structures when there's no technical requirement should always be avoided IMO. Good practices may be intended, but any value is lost when the price is incompatibility and ugly hacks.
The text was updated successfully, but these errors were encountered: