Reputation: 338
I have the following project structure
Library2 ---> Library1 (Library2 is install using npm to Library1)
Library1 ---> clientApp1 (angular application) (then Library1 is install using npm to clientApp1)
Now I want to allow clientApp1
to have access to Library2
functionality. Is it possible to do it with Library1
exposing Library2
to clientApp1
, instead of independently install library2
to clientApp1
NOTE: Want to access
Library2
functionalities that do not override intoLibrary1
Upvotes: 2
Views: 294
Reputation: 8491
If I understand correctly your question.
You can add the third party library as dependencies of your custom library into the package.json
file
// projects/myCustomLibrary/package.json
"dependencies": {
"@angular/google-maps": "^11.2.4", // <-- third library
}
Then add it as a white listed dependencies into the ng-package.json
// projects/myCustomLibrary/ng-package.json
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/website",
"assets": ["./assets"],
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"moment": "moment"
}
},
"whitelistedNonPeerDependencies": [
"@angular/google-maps" // <-- here
]
}
then, we you do your npm i myCustomlibrary
it will directly install de dependency and you'll be able to access it directly with your module like the following
import { GoogleMapsModule } from '@angular/google-maps'
Be aware, vscode doesn't then find the auto import of those module, I've already opened a question for it here
Upvotes: 2