I'm working in a monorepo environment with nx, structured as follows:
apps
| - my-app
libs
| - common
| - my-client
After deployment, the libraries are published on npm with the names @my-org/my-client
and @my-org/common
. I have set up path aliases in tsconfig.conf
to directly reference them in my-app
code:
"paths": {
"@my-org/my-client": ["libs/my-client/src/index.ts"],
"@my-org/common": ["libs/common/src/index.ts"]
}
The problem arises when my-app
uses an external package another-external-package
that relies on the published version of @my-org/common
.
It appears that when I import @my-org/common
in my-app
, it defaults to the peer dependency of @my-org/common
from another-external-package
, instead of using the alias defined in tsconfig.conf
.
This issue only occurs in production builds, not in the development environment. Any suggestions on how to instruct nx/tsc to prioritize the library over the published package?