diff --git a/packages/compiler-core/__tests__/utils.spec.ts b/packages/compiler-core/__tests__/utils.spec.ts index 45fa46fea7a..f2ea70cc51d 100644 --- a/packages/compiler-core/__tests__/utils.spec.ts +++ b/packages/compiler-core/__tests__/utils.spec.ts @@ -122,6 +122,10 @@ describe('isMemberExpression', () => { expect(fn(`123[a]`)).toBe(true) expect(fn(`foo() as string`)).toBe(false) expect(fn(`a + b as string`)).toBe(false) + // #9865 + expect(fn('""')).toBe(false) + expect(fn('undefined')).toBe(false) + expect(fn('null')).toBe(false) }) }) diff --git a/packages/compiler-core/src/utils.ts b/packages/compiler-core/src/utils.ts index baffe5086f6..fe4141507bc 100644 --- a/packages/compiler-core/src/utils.ts +++ b/packages/compiler-core/src/utils.ts @@ -163,7 +163,7 @@ export const isMemberExpressionNode = __BROWSER__ return ( ret.type === 'MemberExpression' || ret.type === 'OptionalMemberExpression' || - ret.type === 'Identifier' + (ret.type === 'Identifier' && ret.name !== 'undefined') ) } catch (e) { return false