-
Notifications
You must be signed in to change notification settings - Fork 77
fix(vite/client): ensure defaultOptions are required and client input can be overwritten #319
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
fix(vite/client): ensure defaultOptions are required and client input can be overwritten #319
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the Vite client configuration to ensure default options are properly typed and the client input can be overwritten instead of being appended to.
- Changes
defaultOptions
to be typed asRequired<ClientOptions>
with a non-empty default input - Simplifies input handling by allowing complete override instead of concatenation
- Removes unnecessary fallback logic in the input assignment
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
build: { | ||
rollupOptions: { | ||
input: ['/app/client.ts', ...input], | ||
input: options?.input ?? defaultOptions.input, |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks backward compatibility. Previously, user-provided input was appended to the default '/app/client.ts' entry point, but now it completely replaces it. Users who relied on the default entry point being included alongside their custom inputs will experience breaking behavior.
input: options?.input ?? defaultOptions.input, | |
input: Array.from(new Set([...(defaultOptions.input), ...(options?.input ?? [])])), |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a valid comment. But I don't see a way to preserve the current behavior without always adding the '/app/client.ts' entry point. What do you think @yusukebe ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you said, we should not hard-code /app/client.ts
in the config, but should be on the defaultOptions
.
I think it's okay to break backward compatibility and go with this current PR implementation as is to keep a simple implementation. This HonoX is in the alpha stage; the breaking change can be introduced without a major bump.
Instead, we have to change the input
value in the following:
Line 777 in 94f7841
input: ['/app/style.css'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yusukebe thanks for the feedback. I've updated the README.
Question: When I create a new honox app using pnpm create hono@latest
-> x-basic
. The following vite.config.ts
is generated. This needs to be adjusted too, correct? If yes, where do I find the vite config template. I was unable to find it in the create-hono
repository: https://github.com/honojs/create-hono
export default defineConfig({
plugins: [
honox({
devServer: { adapter },
client: { input: ['./app/style.css'] }
}),
tailwindcss(),
build()
]
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be adjusted too, correct?
Yes.
If yes, where do I find the vite config template. I was unable to find it in the
create-hono
repository: https://github.com/honojs/create-hono
You find it here: https://github.com/honojs/starter/tree/main/templates/x-basic
So, can you create a PR to update it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! No problem. Here is the PR: honojs/starter#109 @yusukebe
…ts when input is overridden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@meck93 Thanks! |
fixes #320