Skip to content

Conversation

meck93
Copy link
Contributor

@meck93 meck93 commented Sep 17, 2025

fixes #320

@Copilot Copilot AI review requested due to automatic review settings September 17, 2025 13:03
Copy link

@Copilot Copilot AI left a 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 as Required<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,
Copy link

Copilot AI Sep 17, 2025

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.

Suggested change
input: options?.input ?? defaultOptions.input,
input: Array.from(new Set([...(defaultOptions.input), ...(options?.input ?? [])])),

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meck93

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:

honox/README.md

Line 777 in 94f7841

input: ['/app/style.css'],

Copy link
Contributor Author

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()
  ]
})
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

@meck93 Thanks!

@yusukebe yusukebe merged commit 2403f2e into honojs:main Sep 21, 2025
2 checks passed
@meck93 meck93 deleted the support-overriding-vite-client-config-input branch September 21, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants