Merge pull request #696 from kaoru0822-kitauji/fix/reference-computed-require

fix(reference): distinguish computed require member names
This commit is contained in:
Kaoru0822
2026-10-06 01:09:56 -07:00
committed by GitHub
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