mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
fix: import node:async_hooks directly (#5198)
This commit is contained in:
@@ -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<typeof AsyncLocalStorage> = import(
|
||||
/* @vite-ignore */
|
||||
/* webpackIgnore: true */
|
||||
moduleName
|
||||
"node:async_hooks"
|
||||
)
|
||||
.then((mod) => mod.AsyncLocalStorage)
|
||||
.catch((err) => {
|
||||
|
||||
Reference in New Issue
Block a user