fix(javascript): resolve root package exports arrays (#1046)

Co-authored-by: N0zoM1z0 <1705004398@qq.com>
This commit is contained in:
AlexandN0zoM1z0 authored and GitHub committed 2026-10-08 12:45:21 +08:00
1 parent 03424ae91e
commit 53409ab196
3 files changed
+26 -4

No files matched your search

@@ -440,12 +440,10 @@ const packageExport = (
moduleKind: ResolveArtifactPathInput["moduleKind"],
): PackageExportOutcome => {
if (typeof value === "string") return packagePathValue(value);
if (typeof value !== "object" || value === null || Array.isArray(value))
return { status: "invalid" };
if (typeof value !== "object" || value === null) return { status: "invalid" };
const root = Reflect.get(value, ".") ?? value;
if (typeof root === "string") return packagePathValue(root);
if (typeof root !== "object" || root === null || Array.isArray(root))
return { status: "invalid" };
if (typeof root !== "object" || root === null) return { status: "invalid" };
const flattened = exportTargets(root, packageExportConditions(moduleKind));
if (flattened.kind === "invalid") return { status: "invalid" };
const first =