2

I'm currently migrating a monolith Angular app into an Angular NX monorepo. The footer component in the monolith accesses the 'version' in the package.json. In the monorepo, the footer component lives in a lib, but I have no idea how to access the package.json file. Can someone please tell me how

CaptainMorgan
  • 1,193
  • 2
  • 25
  • 55

1 Answers1

0

I had the same issue. Package.json can't be accessed from a lib project, although it can be accessed from an app project. Taking this into consideration, you can create an InjectionToken which would hold the version.

Provide the token at the app level, and then inject it anywhere you need it.

It is generally a good practice to provide environment-related data at the app level.