Replies: 2 comments 1 reply
-
I think you are looking for webpack/enhanced-resolve#410 |
Beta Was this translation helpful? Give feedback.
-
By default, pnpm workspaces do not work with peer dependencies because of how pnpm uses symlinks to create workspace dependencies: build -> ../../../build The Pnpm dependenciesMeta.injected rule makes workspace dependencies install like they came from the registry. All you need to do is set injected to true under dependenciesMeta in the package.json that declares the workspace dependency: "dependenciesMeta": { This tells pnpm to install the workspace dependency under node-modules/.pnpm/file+[package-specifier] instead of symlinking to the workspace directory. Because the dependency is installed as a normal node package, it does not include dev dependencies and respects the peer dependency configuration. However, because you lose the symlink, you lose the ability to make local changes and have them be reflected immediately. The workspace dependency under node_modules/.pnpm is a copy of the files in packages/[package-name], so it will not update until you run pnpm i. |
Beta Was this translation helpful? Give feedback.
-
I ran into an issue where webpack does not resolve peerDependcies correctly on a pnpm monorepo, leading to duplicate packages being loaded.
Is this a bug in webpack?
I reproduced the issue here: https://github.com/kbrooks/peer-dep-problem-repro
The repo packs two versions of jotai into
test-app
instead of using the peerDependencies field ontest-package
's package.json to use the same version of jotai used bytest-app
.Beta Was this translation helpful? Give feedback.
All reactions