storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
98 stars 29 forks source link

[Bug] Support for `svelte 5` #156

Open bhvngt opened 7 months ago

bhvngt commented 7 months ago

Describe the bug

When I try to run this plugin with svelte 5, it reports following error.

WARN 🚨 Unable to index files:
[SB] WARN - ./src/lib/Button/Button.stories.svelte: Cannot read properties of undefined (reading 'instance')
[SB] WARN - ./src/lib/Image/Image.stories.svelte: Cannot read properties of undefined (reading 'instance')
[SB] WARN - ./src/lib/Counter/Counter.stories.svelte: Cannot read properties of undefined (reading 'instance')

Steps to reproduce the behavior

  1. Upgrade svelte to svelte@next
  2. run storybook
  3. See error

Expected behavior

It should work with svelte 5

Environment

Additional context

Svelte 5 is cutting edge and is very new. So just filing this bug in case if it is a minor change to support it.

j3rem1e commented 7 months ago

I'm not sure Storybook itself supports Svelte 5 🙂

bhvngt commented 7 months ago

Svelte 5 is backward compatible with svelte 4. So I was trying to upgrade svelte without trying out any of the new svelte 5 syntax.

JReinhold commented 7 months ago

Here's the upstream issue: https://github.com/storybookjs/storybook/issues/24886

(might not be the same problem though)

JReinhold commented 6 months ago

We've added preliminary Svelte 5 support in the Storybook 8 alphas, you could try upgrading to those and see if that fixes the issue. If it does I think we can close it.

npx storybook@next upgrade --prerelease

Based on the errors you've reported it looks like a Storybook core issue and not related to this addon.

ryu-man commented 5 months ago

I got this error using storybook 8 with svelte 5 installed

Unable to index ./src/stories/Test.stories.svelte:
WARN   TypeError: Cannot read properties of undefined (reading 'instance')
eunukasiko commented 4 months ago
- ./src/lib/components/button/Button.stories.svelte: Cannot read properties of undefined (reading 'instance')
bhvngt commented 4 months ago

I tried this plugin on the latest 8.0.0-rc.2 release which supports svelte 5. I have used the latest 4.1.2 for my reproduction.

I am getting the same error as @eunukasiko.

Here's the link to the sandbox.

RobinKnipe commented 3 months ago

SB v8 now released. Would be great if Svelte5 were supported.

bhvngt commented 2 months ago

Since svelte 5 has reached release-candidate. Would this be a good time to add support for svelte 5?

This add-on makes story creation for svelte so much easier. So thanks a ton to all the contributors for creating this add-on. 👏👏👏

xeho91 commented 2 months ago

There's a work in progress #177