Package · PKG0005 · PKG0006
Declare singleton packages by range
Find published workspace packages that declare an exact version of a package the app must load once, such as vue, nuxt, nitro, h3, vite, react or drizzle-orm, in peerDependencies, dependencies or optionalDependencies. catalog: and workspace: specifiers are resolved to the range pnpm publishes. Add packages with the singletons option.
Run this rule
pnpm vite-doctor . --extends package/recommended --rules package/no-pinned-singleton
Why it matters
An app shares a singleton only when every declaration accepts the app's version. An exact peer fails strict peer checks or makes the package manager install a second copy next to the app's, and an exact dependency installs its own copy whenever the app has another version. Two copies of Vue, Nuxt or React split their state, so injections and composables find nothing, and two copies of h3 or Drizzle fail their identity checks.
Recommended fix
Declare the peer as a range that accepts the app's version, such as "^3.5.44", or point catalog: at a catalog entry that is a range. For a dependency, take the singleton from the app as a peer, or depend on a range. Configure more singletons with "warn", { "singletons": "comark", "@ai-sdk/*" }.
Useful links
Example
Accept the app's Vue
Before
{ "peerDependencies": { "vue": "3.5.44" } }
After
{ "peerDependencies": { "vue": "^3.5.44" } }