fix(plugin-vite): declare vite as a peer dependency - #4354
Open
tifandotme wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summarize your changes:
Fixes #4350.
@electron-forge/plugin-viterequires Vite at runtime fromdist/VitePlugin.js,dist/ViteConfig.jsand the threedist/config/vite.*.config.jsfiles, but declares it only indevDependencies. A hoistednode_modulesresolves this by accident, through the application's own copy of Vite. A strict layout does not resolve it at all, so the plugin cannot be loaded andelectron-forge startandelectron-forge packageboth fail. The issue has a Bun 1.4 reproduction. pnpm and Yarn PnP fail for the same reason.Why a peer dependency and not a regular one
plugin-webpackdeclareswebpackas a regular dependency, but Vite is not the same case. Webpack is an implementation detail of that plugin. Vite is chosen by the application: the user writesvite.main.config.tsand picks the major version, and Forge reads that file withloadConfigFromFilefrom whichever Vite it resolves. A pinned regular dependency would install a second Vite and parse the user's config with the wrong major. A peer dependency keeps one Vite in the tree.Range
>=5matches what the package supports in practice: 7.11.2 shipped againstvite@^5,mainbuilds against^6, and applications on^7and^8work today. Happy to narrow it to an explicit list if you prefer.Repository constraints
No constraint churn.
enforceConsistentDependenciesAcrossTheProjectinyarn.config.cjsskipspeerDependenciesand already exemptsviteby name.vitestays indevDependenciesfor the package's own tests.yarn.lockpicks up the two-line peer entry for the workspace.Tests
None added. The change is package metadata with no code path to assert on, and the regression it prevents is only observable from a real install under a strict linker.