Skip to content

Commit

Permalink
add a document about pnpm monorepo error
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Feb 1, 2023
1 parent b490776 commit 09f3fda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/pnpm-injected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Incorrect package deduping for compat addons in pnpm

As part of the process of rewriting v1 addons there is a type of de-duplication that is affectionalty called "smooshing". This prevents there from being many instances of old v1 addons in an embroider build.

With this process there can be a rare case where it doesn't act as required. For example, if you're using pnpm in a monorepo and there are multiple packages that have similar peer dependencies you can sometimes fall into an issue where the code for smooshing gets confused. This is because it uses the exact folder location for a dependency as a key in the v1 addon cache (you can see more [in this file](https://github.com/embroider-build/embroider/blob/main/packages/compat/src/build-compat-addon.ts)) but pnpm duplicates dependency trees that have any differences in subdependencies and has different file locations for these duplicates. You can read more about this in the pnpm docs: https://pnpm.io/how-peers-are-resolved

The solution to this issue `dependenciesMeta.*.injected` for the shared monorepo package which will prevent there from being an extra duplicate tree created in the dependencies. You can read more about this config in the pnpm documentation https://pnpm.io/package_json#dependenciesmetainjected

0 comments on commit 09f3fda

Please sign in to comment.