From cd73bd810796e4b64545134d43667c4cacd80d72 Mon Sep 17 00:00:00 2001 From: Tim Branyen Date: Wed, 7 Feb 2024 13:39:37 -0800 Subject: [PATCH] fix(class): history.replaceState member expression --- transforms/class.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/transforms/class.js b/transforms/class.js index ff7a212a..fdcff2f1 100644 --- a/transforms/class.js +++ b/transforms/class.js @@ -176,8 +176,15 @@ module.exports = (file, api, options) => { path.parentPath && path.parentPath.value && path.parentPath.value.object && - path.parentPath.value.object.name && - path.parentPath.value.object.name === 'history' + ( + // First check if history is the top level + path.parentPath.value.object.name && + path.parentPath.value.object.name === 'history' || + + // Or is it part of a memberexpression? + path.parentPath.value.object.property && + path.parentPath.value.object.property.name === 'history' + ) ) { correctContext = false; }