Within my Angular lib, residing in an Nx workspace...
The lib relies on another local lib for shared TypeScript code.
The path to the shared lib is set in the tsconfig paths configuration:
"paths": {
"@myOrg/sharedLib": ["libs/shared/src/index.ts"],
}
Code from the shared lib is imported using TypeScript imports like this:
import {someUtilFn} from '@myOrg/sharedLib'
The issue at hand is: How do I ensure that the code from the shared lib is included in the compiled Angular library? Currently, the built Angular library only includes its own code and excludes external dependencies. This means whoever uses the Angular lib (e.g. by npm installation) will need to also install the shared lib separately.
Given that the Angular lib will be distributed via npm... one option is to publish the shared lib as well and specify it as a dependency / peer dependency of the Angular library. However, I want to prevent users of the Angular lib from directly importing code from the shared lib.