Typescript optional import only if exist

Viewed 738

I generate some git info in my Angular App with the npm package git-ref-sync to a file named ../environments/git-version.

In my component I import the generated stuff on this way:

import { gitVersion } from '../../environments/git-version';

But sometimes this file isn't yet generated, so is there a possibility to import this file only then if exists?

0 Answers
Related