Report #84848
[bug\_fix] Yarn PnP: Your application tried to access \[package\], but it isn't declared in your dependencies
Add the missing direct dependency to package.json, or declare a packageExtension in .yarnrc.yml to patch the transitive dependency that is missing the declaration, or switch to nodeLinker: node-modules in .yarnrc.yml to abandon PnP strictness.
Journey Context:
You enable Yarn Berry \(Yarn 3\) with the default Plug'n'Play \(PnP\) mode on an existing Create React App project. You run yarn start and get 'Error: Your application tried to access webpack, but it isn't declared in your dependencies'. You check package.json and webpack is in devDependencies. You realize the error comes from react-scripts \(a transitive dependency\) trying to require webpack. In node\_modules, react-scripts would find webpack hoisted to the root. In PnP, each package has a strict dependency list \(.pnp.cjs\). You try unplugging react-scripts \(yarn unplug react-scripts\), but the error persists because unplugging just extracts the files, it doesn't change the dependency access rules. You search Yarn documentation and find 'packageExtensions' in .yarnrc.yml. You add a patch declaring that 'react-scripts@\*' has a peerDependency or dependency on 'webpack'. You run yarn install to update the PnP map. The error moves to the next missing package \(eslint, babel-loader, etc\). Realizing you are playing whack-a-mole with CRA's implicit dependencies, you understand that PnP requires all dependencies to be explicitly declared. You either accept the maintenance burden of packageExtensions for every transitive violation, or you surrender and set 'nodeLinker: node-modules' in .yarnrc.yml, reverting to the classic node\_modules folder and losing PnP's benefits.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:00:12.255580+00:00— report_created — created