fix: migrate Legacy*.svelte runtime mocks to Svelte 5 runes syntax#348
Open
XIYO wants to merge 1 commit into
Open
fix: migrate Legacy*.svelte runtime mocks to Svelte 5 runes syntax#348XIYO wants to merge 1 commit into
XIYO wants to merge 1 commit into
Conversation
LegacyTemplate.svelte and LegacyStory.svelte used Svelte 4 `export let` syntax. Vite 8 Rolldown pre-bundles node_modules .svelte files via vite-plugin-svelte:optimize and rejects `export let` as legacy_export_invalid, causing a blank Storybook preview. Converted both files to Svelte 5 $props() runes. These are mock stubs only — never rendered, only used for IDE type support. The pre-transform codemod still handles the actual AST rewrite before Svelte compilation. No behavioral change. Fixes storybookjs#337
🦋 Changeset detectedLatest commit: 5ce1f92 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #337
Problem
Vite 8 introduced Rolldown as the bundler, which pre-bundles
.sveltefiles innode_modulesvia thevite-plugin-svelte:optimizeplugin. Rolldown rejects Svelte 4export letsyntax aslegacy_export_invalid, causing Storybook to silently render a completely blank preview with no error output.Affected files:
src/runtime/LegacyTemplate.svelte—export let idtriggers the errorsrc/runtime/LegacyStory.svelte—export letprops trigger the errorFix
Converted both files from Svelte 4 syntax to Svelte 5
$props()runes:LegacyTemplate.svelte
LegacyStory.svelte
Why this is safe
These files are mock stubs — they are never actually rendered. Their sole purpose is IDE type support. The real work happens in the Vite pre-transform codemod which rewrites
<Template>and<Story>tags into{#snippet}anddefineMetacalls at the AST level, before Svelte ever sees the components.Converting to
$props()has zero behavioral impact.Tested with
@storybook/sveltekit10.x