-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add TurboSnap support for Vite #521
Conversation
We can do that in the vite rollup plugin, instead
I've been running turbosnap on my own repo with these (and other) changes |
I'm working on enabling Chromatic [Turbosnap](https://www.chromatic.com/docs/turbosnap) capability for vite storybook projects, and it requires a small change to the way we load in our stories to match up more closely to how the webpack builders work. They have a separate entrypoint for just the stories, so I've moved what used to be done in the virtual `storybook-stories.js` imported directly off of the iframe, into a virtual file that's imported from the virtual `vite-app` module. This actually more closely aligns with the way that the "modern" (storyStoreV7) code works too, which is a nice side-benefit. I also needed to move the preview entry to it's own file, for the same reason. I didn't move anything in the storyStoreV7 version, mostly because I'm not using storyStoreV7, and don't have a great way to test out that it's working correctly if I do muck with it. For now I'd like to take things one step at a time and support turbosnap for non-storyStoreV7 builds. I've used `patch-package` to run this code in my own storybook at work to ensure that turbosnap works the way I am intending. So far it seems to be working well. Here is the corresponding PR in chromatic-cli to enable vite support: chromaui/chromatic-cli#521.
Hey @IanVS thank you so much for all of your efforts! As always the work you've been doing is incredible and we're incredibly thankful for each and every contribution you make! Thanks for helping Storybook and its ecosystem thrive! |
Released in 6.5.0. |
I'm on a mission to use turbosnap in my own project, which is built using storybook-builder-vite. It's going to take a few different pieces:
preview-stats.json
from webpack.