-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Auto migration: Check for missing vite.config.js #25453
Comments
What is the context of this? My knowledge is that it is not necessarily required to have a vite.config.js in place. Storybook should support this. cc @kasperpeulen, @IanVS |
We talked about no longer supplying Vite framework plugins like So, if we don't force the user to have a framework plugin configured, how should storybook work? |
Are you talking about meta frameworks, which don't require a vite config? If you want to use vite with let's say svelte, doesn't a plugin has to be in place and configured? Can you list scenarios where a vite config is not in place and vue, react, svelte,... just still work? |
No I'm not talking about metaframeworks. The reason we added Vite framework plugins like But it's hard for us to know what framework plugin to include, because we support so many versions of Vite now and the plugins have fairly strict peer dependency ranges. The solution we discussed was to remove the "fallback" framework plugins from Storybook, and then create an automigration that would install an appropriate vite framework plugin and either update the user's |
If we make this change in 8.0 we have to solve for two different cases: (1) upgrades from earlier versions, (2) new installs. Upgrades. I think the upgrade is pretty easy. We check for what we require as part of an automigration, and then explain to the user what we're going to create for them, and then create it. Installs. This is the trickier bit. I suppose we could just do something very similar. However I don't like adding a random prompt to the install process. We could consider doing approx the same logic automatically on install. |
Thanks for the context Ian. Design libraries without an explicit builder configuration were the missing piece for me. |
I think it's dangerous to change any existing Vite config. If a user has a Vite config but without the framework plugin, I can only imagine that is for a very specific reason that we don't want to break. Eg. a Remix-Vite project won't have the React Vite plugin and we wouldn't want to add that there. Which brings me to my next issue, detecting which Vite plugin is applied is actually pretty hard. They could be applied transitively through other plugins, eg. the SvelteKit plugin includes the Svelte plugin under-the-hood, and the only way to know this is to apply all the plugins via Vite and go through the plugins' names. Maybe there's a "good enough" middle ground somewhere though? |
If a
vite.config.js
(or any other accepted vite configuration file) doesn't exist, tell the user to runnpx vite@latest init
because Storybook doesn't set up any plugins by default.The text was updated successfully, but these errors were encountered: