diff --git a/packages/babel-plugin-jsx-dom-expressions/src/shared/utils.js b/packages/babel-plugin-jsx-dom-expressions/src/shared/utils.js index 61bd4b81..d958ec9c 100644 --- a/packages/babel-plugin-jsx-dom-expressions/src/shared/utils.js +++ b/packages/babel-plugin-jsx-dom-expressions/src/shared/utils.js @@ -94,7 +94,7 @@ export function isDynamic(path, { checkMember, checkTags, checkCallExpressions = return false; } - if (checkCallExpressions && (t.isCallExpression(expr) || t.isOptionalCallExpression(expr))) { + if (checkCallExpressions && (t.isCallExpression(expr) || t.isOptionalCallExpression(expr) || t.isTaggedTemplateExpression(expr))) { return true; } diff --git a/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/code.js b/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/code.js index 1ea24bbf..f5bedf05 100644 --- a/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/code.js +++ b/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/code.js @@ -27,6 +27,9 @@ const singleExpression = <>{inserted}; const singleDynamic = <>{inserted()}; +const greeting = (x) => "Hello " + x; +const singleTemplateLiteral = <>{greeting`world`} + const firstStatic = ( <> {inserted} diff --git a/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/output.js b/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/output.js index bba096fc..49f0df99 100644 --- a/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/output.js +++ b/packages/babel-plugin-jsx-dom-expressions/test/__dynamic_fixtures__/fragments/output.js @@ -27,6 +27,8 @@ const multiDynamic = [ ]; const singleExpression = inserted; const singleDynamic = _$memo(inserted); +const greeting = x => "Hello " + x; +const singleTemplateLiteral = _$memo(() => greeting`world`); const firstStatic = [inserted, _tmpl$3()]; const firstDynamic = [_$memo(inserted), _tmpl$3()]; const firstComponent = [_$createComponent(Component, {}), _tmpl$3()];