From f6a97a0c20b53788e54dab31191032b3e905a93a Mon Sep 17 00:00:00 2001 From: Maddipatla Chatan Date: Fri, 4 Sep 2026 18:10:49 +0530 Subject: [PATCH] Update transform-cup-globals.js --- publish/transform-cup-globals.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/publish/transform-cup-globals.js b/publish/transform-cup-globals.js index afe2519196..920b891c49 100644 --- a/publish/transform-cup-globals.js +++ b/publish/transform-cup-globals.js @@ -1,10 +1,8 @@ /* Copyright (c) Uber Technologies, Inc. - This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. */ - /* eslint-env node */ module.exports = (babel) => { @@ -13,10 +11,10 @@ module.exports = (babel) => { const buildAst = babel.template(` typeof document !== 'undefined' `); - const buildAst2 = babel.template(` typeof document === 'undefined' `); + const targetMap = { __NODE__: buildAst2({}), __BROWSER__: buildAst({}), @@ -35,10 +33,8 @@ module.exports = (babel) => { if (name !== '__DEV__' && name !== '__NODE__' && name !== '__BROWSER__') { return; } - if (path.parent.type === 'MemberExpression') { - return; - } - if (path.parent.type === 'ClassMethod') { + const parentType = path.parent.type; + if (parentType === 'MemberExpression' || parentType === 'ClassMethod') { return; } if (path.isPure()) {