Answers for "angular use version from package.json"

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 use version from package.json"

Browse Popular Code Answers by Language