Skip to content

validate-dependencies

Fails the build when the published output imports a package that package.json does not install for a consumer.

Every bare specifier in the scanned folders (dist/lib and bin by default, code and declarations, ESM and CommonJS) must name a package in dependencies, optionalDependencies or peerDependencies, the package itself, or a builtin (any node: specifier, Node’s own, and Electron’s electron and original-fs); a declaration file’s import may also be served by the package’s @types one. A package in devDependencies only is present in the package’s own repository and absent from a consumer’s install, so nothing there fails, and the consumer gets Cannot find module.

Interface Description
ValidateDependenciesOptions Options for validateDependencies.
Function Description
validateDependencies Checks that every bare import in the published output names a package a consumer installs.
Variable Description
DEFAULT_VALIDATE_DEPENDENCIES_FOLDERS The folders validateDependencies scans when none are given.