Skip to content

Commit 1a7cbe9

Browse files
committed
Fix resolveEntry function for array export
1 parent 31805a1 commit 1a7cbe9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

server/build_resolver.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,18 @@ func (ctx *BuildContext) resolveEntry(esm EsmPath) (entry BuildEntry) {
314314
}
315315
*/
316316
exportEntry = ctx.resolveConditionExportEntry(obj, pkgJson.Type)
317+
} else if arr, ok := v.([]any); ok {
318+
/**
319+
exports: {
320+
".": ["./cjs/index.js", "./esm/index.js"]
321+
}
322+
*/
323+
a0 := arr[0]
324+
if s, ok := a0.(string); ok {
325+
exportEntry.update(s, pkgJson.Type == "module")
326+
} else if obj, ok := a0.(npm.JSONObject); ok {
327+
exportEntry = ctx.resolveConditionExportEntry(obj, pkgJson.Type)
328+
}
317329
}
318330
} else {
319331
/**

0 commit comments

Comments
 (0)