-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
We are currently in the process of migrating our private monorepo from yarn classic to yarn modern, specifically yarn pnp, in order to take advantage of the latest yarn features. Although this query may have been addressed in the past, I am seeking further clarification on dependency management with yarn berry.
Suppose we have a monorepo with the following structure, which has been migrated to yarn modern but not yet to pnp:
βββ package.json # Includes webpack as a dependency
βββ apps
β βββ app1
β β βββ package.json # Contains a "build" script that runs "webpack mode --production"
β βββ app2
β β βββ package.json
β βββ app3
β βββ package.json
βββ libs
βββ core
βββ package.json
In this case, when running the build script from app1, the error "command not found: webpack" is displayed. After researching online, I discovered that this can be resolved by adding "run -T" to the build command, resulting in "run -T webpack mode --production". However, this solution would need to be added not only to commands using webpack, but to all commands that reference dependencies from the root level (e.g. tsc). Given that there are around 220 packages in this monorepo, this solution would be cumbersome.
Is there an alternative solution to this issue?