A common workspace monorepo pattern is to have common, most or all dependencies installed at a root level package.json while still having a package.json in the workspace of each project.
If app1 defines a shared dependency that is installed via the root package.json but does not provide a requiredVersion, the SharePlugin will only look at the package.json in the app1 directory and throw an error when it cannot find it listed.
This issue can be seen HERE when a nested NextJS application is using the @module-federation/nextjs-mf plugin. next is installed as a dependency at the root of the monorepo, but the DEFAULT_SHARE_SCOPE sets requiredVersion: undefined for the internals. The plugin only searches the nearest package.json and never finds the correct version defined in the root package.json
Describe the bug
A common workspace monorepo pattern is to have common, most or all dependencies installed at a root level
package.json
while still having apackage.json
in the workspace of each project.If
app1
defines a shared dependency that is installed via the rootpackage.json
but does not provide arequiredVersion
, theSharePlugin
will only look at thepackage.json
in theapp1
directory and throw an error when it cannot find it listed.This issue can be seen HERE when a nested
NextJS
application is using the@module-federation/nextjs-mf
plugin.next
is installed as a dependency at the root of the monorepo, but the DEFAULT_SHARE_SCOPE setsrequiredVersion: undefined
for the internals. The plugin only searches the nearestpackage.json
and never finds the correct version defined in the rootpackage.json
Reproduction
https://github.com/robdonn/nested-shared-example
Used Package Manager
pnpm
System Info
Validations