yarn-check-webpack-plugin
raw JSON → 1.2.0 verified Sat Apr 25 auth: no javascript maintenance
A webpack plugin that verifies there are no missing or outdated yarn dependencies during development. The plugin runs `yarn check --integtrity` as a webpack compilation hook and displays warnings for missing or wrong version packages. It is designed for large codebases where dependencies change frequently across branches. The current stable version is 1.2.0, but the package appears in maintenance mode (last release in 2019). It is type-safe with TypeScript types included. Exclusive in its integration of yarn's dependency checking directly into the webpack build lifecycle, differentiating it from lint-based or separate CLI approaches.
Common errors
error Cannot find module 'yarn-check-webpack-plugin' ↓
cause Package not installed.
fix
yarn add -D yarn-check-webpack-plugin
error TypeError: YarnCheck is not a constructor ↓
cause Default import used instead of named import.
fix
Use { YarnCheck } from 'yarn-check-webpack-plugin'
error Missing packages: \n - lodash\nPlease run `yarn install --check-files` to update. ↓
cause A package is missing from node_modules.
fix
Run 'yarn install --check-files' to restore missing packages.
Warnings
deprecated yarn check --integtrity has been removed in Yarn 2+ (Berry). The plugin will not work with Yarn >=2. ↓
fix Use yarn-plugin or upgrade to a tool like 'check-dependencies', or stay on Yarn Classic.
breaking In version 1.2.0, the 'forceKill' option was added. If you used an earlier version, your config object might be missing this property – safe to ignore. ↓
fix Add 'forceKill' property if needed, otherwise it's optional.
gotcha The plugin only runs when yarn.lock is present; if using npm or pnpm, it will silently no-op. ↓
fix Use the appropriate plugin for your package manager (e.g., npm-check-webpack-plugin).
gotcha The plugin runs a spawn of 'yarn check' on every compilation. This can add overhead in large projects. ↓
fix Consider using a watch mode filter or only run in development.
Install
npm install yarn-check-webpack-plugin yarn add yarn-check-webpack-plugin pnpm add yarn-check-webpack-plugin Imports
- YarnCheck wrong
import YarnCheck from 'yarn-check-webpack-plugin'correctimport { YarnCheck } from 'yarn-check-webpack-plugin' - YarnCheck
const { YarnCheck } = require('yarn-check-webpack-plugin') - YarnCheckOptions
import { YarnCheckOptions } from 'yarn-check-webpack-plugin'
Quickstart
// webpack.config.js
const { YarnCheck } = require('yarn-check-webpack-plugin');
module.exports = {
// ... other config
plugins: [
new YarnCheck({
rootDirectory: __dirname,
exclude: /some-package/
})
]
};