Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-coins-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': minor
---

The migration warning when slots cannot be migrated due to naming conflicts now states the name of the slot causing the issue
4 changes: 2 additions & 2 deletions packages/svelte/src/compiler/migrate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ const template = {
name = state.scope.generate(slot_name);
if (name !== slot_name) {
throw new MigrationError(
'This migration would change the name of a slot making the component unusable'
`This migration would change the name of a slot (${slot_name} to ${name}) making the component unusable`
);
}
}
Expand Down Expand Up @@ -1880,7 +1880,7 @@ function handle_identifier(node, state, path) {
let new_name = state.scope.generate(name);
if (new_name !== name) {
throw new MigrationError(
'This migration would change the name of a slot making the component unusable'
`This migration would change the name of a slot (${name} to ${new_name}) making the component unusable`
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable -->
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot (derived to derived_1) making the component unusable -->
<script>
let derived;
</script>
<Component>
<slot name="derived" slot="derived" />
</Component>
</Component>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable -->
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot (body to body_1) making the component unusable -->
<script>
let body;
</script>

<slot name="body"></slot>
<slot name="body"></slot>
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot making the component unusable -->
<slot name="dashed-name"></slot>
<!-- @migration-task Error while migrating Svelte code: This migration would change the name of a slot (dashed-name to dashed_name) making the component unusable -->
<slot name="dashed-name"></slot>