Answers for "angular access package.json version"

2

angular get version from package.json

In your /tsconfig.json (sometimes also necessary in 
/src/tsconfig.app.json) enable the resolveJsonModule 
option (webpack dev server restart required afterwards):

"compilerOptions": {
      ...
      "resolveJsonModule": true
      ...
}

Then in your component, for example /src/app/app.component.ts
use the version info:

import { version } from '../../package.json';
...
export class AppComponent {
      public version: string = version;
}
Posted by: Guest on April-07-2021

Code answers related to "angular access package.json version"

Browse Popular Code Answers by Language