fix(reference): distinguish computed require member names

This commit is contained in:
Kaoru0822
2026-10-06 00:26:08 -07:00
parent 132a3a46be
commit df6e476d67
3 changed files with 198 additions and 1 deletions
+2 -1
View File
@@ -188,7 +188,8 @@ const isRequireCallee = (callee: Node | null | undefined): boolean => {
isMemberExpression(callee) &&
isIdentifier(callee.object) &&
callee.object.name === "require" &&
(isIdentifier(callee.property) || isStringLiteral(callee.property))
((!callee.computed && isIdentifier(callee.property)) ||
isStringLiteral(callee.property))
) {
const propertyName = isIdentifier(callee.property)
? callee.property.name