mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 01:01:42 +00:00
fix(ai): replace Function-based dynamic imports with module imports (fixes #1814)
This commit is contained in:
parent
0199abfd11
commit
668ebc0941
3 changed files with 13 additions and 8 deletions
|
|
@ -6,10 +6,11 @@ let _os: typeof NodeOs | null = null;
|
|||
|
||||
type DynamicImport = (specifier: string) => Promise<unknown>;
|
||||
|
||||
const dynamicImport = new Function("specifier", "return import(specifier);") as DynamicImport;
|
||||
const dynamicImport: DynamicImport = (specifier) => import(specifier);
|
||||
const NODE_OS_SPECIFIER = "node:" + "os";
|
||||
|
||||
if (typeof process !== "undefined" && (process.versions?.node || process.versions?.bun)) {
|
||||
dynamicImport("node:os").then((m) => {
|
||||
dynamicImport(NODE_OS_SPECIFIER).then((m) => {
|
||||
_os = m as typeof NodeOs;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue