From 3c8e7b289fe93fd1e9c00adbb47c82999aed07f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 26 Jun 2026 13:12:47 +0000 Subject: [PATCH] fix(webpack-cli): declare json5/js-yaml/toml as optional peerDependencies The CLI parses `.json5`, `.yaml`/`.yml` and `.toml` configs by loading the respective parser (`json5`, `js-yaml`, `toml`) from the user's project, but these packages were not declared anywhere in webpack-cli's manifest. Under strict Yarn PnP (`pnpFallbackMode: none`) an undeclared package is unsound to resolve, so the parser cannot be reached and there is no signal telling users which package to install. Declare them as optional peerDependencies (mirroring webpack-dev-server and webpack-bundle-analyzer) so package managers surface the requirement and the parsers resolve correctly under PnP when the user installs them. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01E8q7bNUb92fDzxLRdLY6L5 --- .changeset/json5-and-yaml-config.md | 2 +- packages/webpack-cli/package.json | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.changeset/json5-and-yaml-config.md b/.changeset/json5-and-yaml-config.md index fd0355f10d7..cb9a6e50611 100644 --- a/.changeset/json5-and-yaml-config.md +++ b/.changeset/json5-and-yaml-config.md @@ -2,4 +2,4 @@ "webpack-cli": minor --- -feat: support `.json5`, `.yaml`/`.yml` and `.toml` configuration files by parsing them directly, with the parser package (`json5`, `js-yaml`, `toml`) installed on demand by the user +feat: support `.json5`, `.yaml`/`.yml` and `.toml` configuration files by parsing them directly, with the parser package (`json5`, `js-yaml`, `toml`) installed on demand by the user and declared as optional `peerDependencies` so the parsers resolve correctly under Yarn PnP diff --git a/packages/webpack-cli/package.json b/packages/webpack-cli/package.json index da325c79931..7182330efe0 100644 --- a/packages/webpack-cli/package.json +++ b/packages/webpack-cli/package.json @@ -44,11 +44,23 @@ "@types/envinfo": "^7.8.4" }, "peerDependencies": { + "js-yaml": "^4.0.0 || ^5.0.0", + "json5": "^2.2.3", + "toml": "^3.0.0 || ^4.0.0", "webpack": "^5.101.0", "webpack-bundle-analyzer": "^4.0.0 || ^5.0.0", "webpack-dev-server": "^5.0.0" }, "peerDependenciesMeta": { + "js-yaml": { + "optional": true + }, + "json5": { + "optional": true + }, + "toml": { + "optional": true + }, "webpack-bundle-analyzer": { "optional": true },