-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix: preprocess svelte file during indexing #94
fix: preprocess svelte file during indexing #94
Conversation
Thanks for this, this is great! 🙏 A few initial thoughts before I've tried it out. This implementation is builder agnostic which is nice. But when looking at the implementation of That would leave out Webpack users though. Is there a compromise where we somehow detect if this is a Vite or Webpack project, and use either the Vite plugin or this "naïve" approach in a Webpack project? At a minimum I think we want to support I'm not sure the whole |
Hey! Thanks for this precious feedback. I completely forgot to deal with the plethora of module loading possibilities! Regarding the link it's mostly what they're doing, the rest being related to IMHO I think that would be better to do it without calling
Tell me what you think about it. If you're agree, in that case I would do it as soon as I can. Quite busy right now but pretty sure I can find some room to do deliver it very quickly. |
I think that sounds like a good plan, looking forward to see your work! If down the road users complain that the preprocessing doesn't match their Vite config, then we can do another pass at integrating deeper with that, but for now let's wait and see. |
Here's a rewrite with the svelte config loader. I kept a variant of previous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it out, a few minor improvements needed, but otherwise great work!
Hey @JReinhold! Thanks a lot for the review. It is now updated accordingly. I used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! If you can apply my suggestion and add fs-extra
as a dependency as it should be, this should be ready to go!
Co-authored-by: Jeppe Reinhold <jeppe@reinhold.is>
Thanks for your hard work @ysaskia ❤️ |
🚀 PR was released in |
Closes #88
It fixes the issue where svelte files wasn't pre-processed during indexing making it impossible to load
*.stories.svelte
files withlang="ts"
for example. Indeed this implementation is a very naïve approach. It walking up the directory tree to look for the firstsvelte.config.js
file. It should solve 90% of the cases since svelte apps don't work without it. Indeed projects with exotic location or specifying a new svelte config in the storybook main file are not taken into account here.Hope it helps
📦 Published PR as canary version:
2.0.12--canary.94.71b3707.0
✨ Test out this PR locally via:
npm install @storybook/addon-svelte-csf@2.0.12--canary.94.71b3707.0 # or yarn add @storybook/addon-svelte-csf@2.0.12--canary.94.71b3707.0
Version
Published prerelease version:
v3.0.0-next.4
Changelog
💥 Breaking Change
🐛 Bug Fix
@sveltejs/vite-plugin
#84 (@JReinhold)Authors: 3