diff --git a/.changeset/five-dingos-push.md b/.changeset/five-dingos-push.md new file mode 100644 index 0000000000..f359f0a9fe --- /dev/null +++ b/.changeset/five-dingos-push.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: migrate default slots to children snippet diff --git a/packages/svelte/src/compiler/migrate/index.js b/packages/svelte/src/compiler/migrate/index.js index 33a369b8c8..c95b0734f9 100644 --- a/packages/svelte/src/compiler/migrate/index.js +++ b/packages/svelte/src/compiler/migrate/index.js @@ -1152,6 +1152,10 @@ function migrate_slot_usage(node, path, state) { is_text_attribute(attribute) ) { snippet_name = attribute.value[0].data; + // the default slot in svelte 4 if what the children slot is for svelte 5 + if (snippet_name === 'default') { + snippet_name = 'children'; + } if (!regex_is_valid_identifier.test(snippet_name)) { has_migration_task = true; state.str.appendLeft( diff --git a/packages/svelte/tests/migrate/samples/slot-usages/input.svelte b/packages/svelte/tests/migrate/samples/slot-usages/input.svelte index 5646174c4c..248ff0ac13 100644 --- a/packages/svelte/tests/migrate/samples/slot-usages/input.svelte +++ b/packages/svelte/tests/migrate/samples/slot-usages/input.svelte @@ -77,6 +77,14 @@