Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite: Fix svelte docgen and svelte-native stories #19339

Merged
merged 6 commits into from
Oct 5, 2022

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Oct 4, 2022

Issue: #19217

Typescript-based svelte components did not generate docs correctly, and svelte-native stories were not possible.

What I did

In the transition to 7.0, we neglected to load svelte options from svelte.config.js (and svelteOptions from storybook overrides) and pass them to the svelte docgen plugin, which means that svelte components written with typescript did not work correctly.

Also, while we brought over the csfPlugin for svelte, we never actually used it. So, svelte-native stories would be broken even if @storybook/addon-svelte-csf was added. The fix here is a bit of a temporary one, hopefully. It uses the same strategy from the 6.5 vite-builder, but it would be better if we could add vite-support to the addon directly, which I've suggested in storybookjs/addon-svelte-csf#64 (comment).

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

Currently we do not have a svelte-vite typescript sandbox, nor do we have any svelte-native stories. But, I bootstrapped my own project, and copied over the dist folder from the svelte-vite framework in this branch, and confirmed that both docgen and svelte-native stories do not work without these changes, and do work with them.

…tions

# Conflicts:
#	code/frameworks/svelte-vite/src/preset.ts
Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants