-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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: Make vite a peer dependency, update plugins #20281
Conversation
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.
Code changes looks good, but we should probably add an entry to MIGRATION.md
We might also want an automigration in this PR? I don't know.
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.
Scratch that, vite was already a peer dep in 6.5, no migration nor automigration needed I think
I need to add an eslint ignore because the svelte plugin does not have a main in package.json. |
# Conflicts: # code/frameworks/react-vite/package.json # code/frameworks/svelte-vite/package.json # code/frameworks/vue3-vite/package.json # code/yarn.lock
@@ -9,6 +9,8 @@ export const core: StorybookConfig['core'] = { | |||
|
|||
export const viteFinal: NonNullable<StorybookConfig['viteFinal']> = async (config, options) => { | |||
const { plugins = [] } = config; | |||
// TODO: set up eslint import to use typescript resolver | |||
// eslint-disable-next-line import/no-unresolved |
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.
#20294 does something similar 👍 |
@ndelangen it looks like during one of the merges of |
Socket Security Pull Request ReportDependency issues detected. If you merge this pull request, you will not be alerted to the instances of these issues again. 📜 Install scriptsInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts. Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.
🧌 Protestware/Troll packageThis package is a joke, parody, or includes undocumented or hidden behavior unrelated to its primary function.
Pull request report summary
Bot CommandsTo ignore an alert, reply with a comment starting with
Powered by socket.dev |
# Conflicts: # code/frameworks/sveltekit/package.json # code/yarn.lock
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.
LGTM! @IanVS do we need to do a followup with some combination of:
- Documentation updates
- Automigration to automatically add a vite dep if you don't have it
@shilman we could, though I'm not entirely convinced it's necessary. I think it makes sense to have the migration for react, since it's surprising to need react in a svelte project, but it's not surprising to need vite in a svelte-vite project. Also, in 6.5, vite was a peer dependency, so this is not a change in 7.0. My personal recommendation would be to avoid making our already-very-long mirgration doc even longer, and wait to see if we hear any confusion over it. Personally I don't think we will. |
@IanVS WFM! Merging 🎉 |
Issue:
Closes #20227
Closes #20214
What I did
This moves
vite
to a peer dependency, and allows either version 3 or 4.It keeps the plugins as normal dependencies. They are only used as fallbacks in case the user does not have a
vite.config.js
. For the most part, the newer plugins will work with vite 3, with the possible exception of svelte. But the solution in those cases is pretty straightforward (update vite or install an older plugin and use a vite.config.js).As noted in #20227, we may want to add a migration step to add vite, but we don't need to add one for the plugins, if we go with this approach.
How to test
CI should pass for all vite frameworks.