From 0717e5de80571f9a8d5cf8c0600f572245e2a79d Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Thu, 9 Oct 2025 17:35:11 -0700 Subject: [PATCH] fix: import `node:async_hooks` directly (#5198) --- packages/core/src/async_hooks/index.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/core/src/async_hooks/index.ts b/packages/core/src/async_hooks/index.ts index 422bdfb8..54e4b49c 100644 --- a/packages/core/src/async_hooks/index.ts +++ b/packages/core/src/async_hooks/index.ts @@ -6,18 +6,10 @@ import type { AsyncLocalStorage } from "node:async_hooks"; // We only export the type here to avoid issues in environments where AsyncLocalStorage is not available. export type { AsyncLocalStorage }; -/** - * Dynamically import AsyncLocalStorage to avoid issues in environments where it's not available. - * - * Right now, this is primarily for Cloudflare Workers. - * - */ -let moduleName: string = "node:async_hooks"; - const AsyncLocalStoragePromise: Promise = import( /* @vite-ignore */ /* webpackIgnore: true */ - moduleName + "node:async_hooks" ) .then((mod) => mod.AsyncLocalStorage) .catch((err) => {