From fa50e8226ca113e39b4a4ba2148f9663cc422f87 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:34:13 +0900 Subject: [PATCH] chore: fix code --- packages/create-vite/src/index.ts | 3 ++- packages/vite/src/shared/hmr.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/create-vite/src/index.ts b/packages/create-vite/src/index.ts index 75748bfb1e7a53..a86fd1958709a8 100755 --- a/packages/create-vite/src/index.ts +++ b/packages/create-vite/src/index.ts @@ -395,7 +395,8 @@ async function init() { }), }, { - type: 'select', + type: (framework: Framework | /* package name */ string) => + typeof framework === 'object' ? 'select' : null, name: 'variant', message: reset('Select a variant:'), choices: (framework: Framework) => diff --git a/packages/vite/src/shared/hmr.ts b/packages/vite/src/shared/hmr.ts index 9951b2bd41c792..a5d7d811566f8c 100644 --- a/packages/vite/src/shared/hmr.ts +++ b/packages/vite/src/shared/hmr.ts @@ -79,9 +79,9 @@ export class HMRContext implements ViteHotContext { // extracted in the server for propagation acceptExports( _: string | readonly string[], - callback: (data: any) => void, + callback?: (data: any) => void, ): void { - this.acceptDeps([this.ownerPath], ([mod]) => callback(mod)) + this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod)) } dispose(cb: (data: any) => void): void {