From b30ac7dae297aaafa442c7050a7d088ac9b7ec0c Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sun, 16 Jun 2024 17:03:57 +0900 Subject: [PATCH 1/2] fix(dev-server): handler cloudflare `dispose` error --- packages/dev-server/src/adapter/cloudflare.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/dev-server/src/adapter/cloudflare.ts b/packages/dev-server/src/adapter/cloudflare.ts index e641d93..f3831b5 100644 --- a/packages/dev-server/src/adapter/cloudflare.ts +++ b/packages/dev-server/src/adapter/cloudflare.ts @@ -20,7 +20,15 @@ export const cloudflareAdapter: (options?: CloudflareAdapterOptions) => Promise< return { env: proxy.env, executionContext: proxy.ctx, - onServerClose: proxy.dispose, + onServerClose: async () => { + try { + await proxy.dispose() + } catch { + /** + * It throws an error if server is not running. + */ + } + }, } } From 815c49ceb8251f8e6fe89e2fd6b85141829c7dad Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sun, 16 Jun 2024 17:04:51 +0900 Subject: [PATCH 2/2] add a changeset --- .changeset/chilly-donuts-develop.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/chilly-donuts-develop.md diff --git a/.changeset/chilly-donuts-develop.md b/.changeset/chilly-donuts-develop.md new file mode 100644 index 0000000..6a0145b --- /dev/null +++ b/.changeset/chilly-donuts-develop.md @@ -0,0 +1,5 @@ +--- +'@hono/vite-dev-server': patch +--- + +fix: handler cloudflare dispose error