Avatar ·

How to display app version from package.json in Angular (TypeScript)?

Hi everyone! I'm developing a mobile app using Angular + Ionic. I want to display the current app version in the footer or on the "About" page. Usually we write the version manually in `package.json`, and I'd like to take it from there to avoid duplication. I tried doing this: ```typescript import { version } from '../../package.json'; @Component({...}) export class AboutPage { appVersion = version; } ``` But TypeScript complains: "Cannot find module '../../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension". Then I enabled `resolveJsonModule` in `tsconfig.json`, but now during build it throws an error that `package.json` is not a module and Webpack cannot resolve it. I tried reading it via `fetch('/package.json')` — at runtime the file