Skip to content

Svelte-5 migration breaks named exports #14115

@ranjan-purbey

Description

@ranjan-purbey

Describe the bug

sv migrate produces invalid javascript when migrating the following svelte 4 code to svelte 5.

Input Svelte4:

<script>
	let a, b;

	export { a }
</script>

Generated Svelte5:

<script>
	let 
	let { a } = $props();, b;

	
</script>

It works fine if the svelte4 version defines both variables as let a; let b; or when both are exported let a, b; export { a, b }.

Reproduction

https://svelte.dev/playground/hello-world?version=5.1.9#H4sIAAAAAAAAA22MzQrDIBCEX0X21EJo7zYUeus71B5M3ICwVdFNfxDfvSvkmON8881UCPaFoOGORFF9YianDug8ozvCAIsnLKAfFfiXuteB8G11S-lU3kjc2WQL7vE5BsbAcgNjmbNPfDXBMCErO6jpIkEiflPMrKptJoznzZO1FAya84rt2f4TAo42rwAAAA==

Logs

No response

System Info

Svelte Playground

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions