storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Support of Svelte 4

oscard0m opened this issue · comments

Describe the feature

Is there a plan to support Svelte 4? I would be happy to help with this if possible.
Storybook has an alpha release in the oven where it will support Svelte v4: storybookjs/storybook#23197

Additional context

https://svelte.dev/blog/svelte-4

I'd be happy to take a look at any PRs adding support for Svelte 4. At the minimum we'd need to bump the versions of svelte and related packages in package.json, similar to what storybookjs/storybook#23197 does. We might need to do more than that, I'm unsure.

it looks like there is a bit more to do:

I tried to simply update it, but it looks like the @storybook/svelte-webpack5 still requires svelte v3.

The only reference to that module in this project that I can find is in the storybook main.js. Shouldn't it be possible to completely remove this module and use the "standard" vite way of bundling instead of webpack?

Thanks for trying @RSWilli !

  1. The fact that @storybook/svelte-webpack5 still only supports Svelte 3 is an error upstream - by me. I need to update that as well.
  2. That dependency is only used for the internal Storybook to test out the features in this project, it's not used for the actual bundling. I'd be happy for anyone to replace it with @storybook/svelte-vite, it should be doable. I'm not exactly sure why the stuff in webpackFinal is needed, maybe it wouldn't be needed in a Vite based setup, or maybe we need to port it over to the Vite equivalent.

That's what I suspected, I am going to try again, since addon-svelte-csf is the only dependency that blocks the update to svelte 4 in my repositories.

I give up again. I tried, but with the vite loader I am getting errors that I cannot explain. Aka: some of the webpack stuff seems to do something

After your PR it should be easier to update this repo though.

@RSWilli Storybook has been updated to support svelte 4 now (https://github.com/storybookjs/storybook/releases/tag/v7.0.27) if you wanted to give it another shot. I'm also seeing an issue with HMR where if you change a story the HMR refresh will overwrite all template args with the args from the last story. But I didn't want to raise that issue until this addon properly supports svelte 4

@rory-orennia I'm at it, although I will not do anything about the HMR issue you mentioned

@rory-orennia I'm at it, although I will not do anything about the HMR issue you mentioned

My hope was that it's caused by the outdated dependencies. I'll raise the issue after this is merged if it still exists

🚀 Issue was released in v3.0.4 🚀