@mastra/core
Version:
27 lines • 1.28 kB
TypeScript
import type { Chat } from 'chat';
import type * as ChatNS from 'chat';
type ChatModule = typeof ChatNS;
/**
* Lazily imports the `chat` package via a literal dynamic import.
*
* The import must stay dynamic (not static) because `chat` is ESM-only (no CJS
* exports): a static import would be compiled to `require('chat')` in the CJS
* build and crash every CJS consumer. A literal dynamic import is safe here
* because this package builds with tsup's `treeshake` option, which emits CJS
* through Rollup and preserves native `import()` in `.cjs` output.
* The `@vite-ignore`/`webpackIgnore` comments keep
* Vite and webpack from pre-resolving the ESM-only package.
*
* The specifier must stay a literal (not a runtime-constructed string) so
* production bundlers can see the dependency — serverless targets like
* Cloudflare Workers must statically bundle `chat` or channels fail at runtime
* with `No such module "chat"` (#19254).
*/
export declare function getChatModule(): Promise<ChatModule>;
/**
* Synchronous accessor for the `chat` module.
* Only safe to call after `getChatModule()` has been awaited (e.g. after `AgentChannels.initialize()`).
*/
export declare function chatModule(): ChatModule;
export type { Chat };
//# sourceMappingURL=chat-lazy.d.ts.map