Skip to content

Commit eaf0087

Browse files
authored
fix: skip log_if_contains_state if only logging literals (#15468)
1 parent 3326bd8 commit eaf0087

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/hungry-monkeys-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: skip `log_if_contains_state` if only logging literals

packages/svelte/src/compiler/phases/3-transform/client/visitors/CallExpression.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export function CallExpression(node, context) {
4444
node.callee.property.type === 'Identifier' &&
4545
['debug', 'dir', 'error', 'group', 'groupCollapsed', 'info', 'log', 'trace', 'warn'].includes(
4646
node.callee.property.name
47-
)
47+
) &&
48+
node.arguments.some((arg) => arg.type !== 'Literal') // TODO more cases?
4849
) {
4950
return b.call(
5051
node.callee,

0 commit comments

Comments
 (0)