Package · dependencies
PKG0002Declare dependencies referenced by published output
Find external packages referenced by library entrypoints and their reachable JavaScript or declarations but absent from consumer dependency declarations.
vite-doctor/packagedependencieswarnSuggestion
Why it happens
A library can work in its own workspace while its JavaScript or declarations fail for consumers under isolated dependency layouts. Development dependencies and another package's transitive dependencies do not establish the consumer contract.
Fix
Declare the referenced package in dependencies or peerDependencies according to who owns it. For a guarded optional integration, declare an optional peer. For declaration-only references, preserve the type dependency for consumers or remove it from the emitted declarations. Rebuild and rerun Doctor; do not infer a compatible version range from an installed transitive dependency.
Example
Declare a dependency retained in dist/index.js
Before
{ "main": "dist/index.js", "devDependencies": { "h3": "^1.0.0" } }
After
{ "main": "dist/index.js", "dependencies": { "h3": "^1.0.0" } }
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --extends package/recommended --rules package/no-phantom-dependencies