diff --git a/.changeset/sixty-pandas-rush.md b/.changeset/sixty-pandas-rush.md new file mode 100644 index 0000000000..0bae18c06c --- /dev/null +++ b/.changeset/sixty-pandas-rush.md @@ -0,0 +1,5 @@ +--- +"svelte": patch +--- + +fix: optimize object property mutations in compilation diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/global.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/global.js index c299dd99ef..811407b35b 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/global.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/global.js @@ -105,6 +105,8 @@ export const global_visitors = { if (serialized_assignment === assignment) { // No change to output -> nothing to transform -> we can keep the original update expression return next(); + } else if (context.state.analysis.runes) { + return serialized_assignment; } else { /** @type {import('estree').Statement[]} */ let statements;