I can't include version from package.json
in angular's library but it works in a project. I use import like that:
import { version } from '../../package.json';
and get the following error:
ERROR: error TS6059: File '/Users/.../library/package.json' is not under 'rootDir' '/Users/.../library/src'. 'rootDir' is expected to contain all source files.
An unhandled exception occurred: error TS6059: File '/Users/.../library/package.json' is not under 'rootDir' '/Users/.../library/src'. 'rootDir' is expected to contain all source files.
See "/private/var/folders/tw/z8v0wkt50g5876740n99hzy00000gp/T/ng-0JDpjC/angular-errors.log" for further details.
The way through require
includes the whole package.json
which incur security risks. import { version } from '../../package.json'
includes only the version number but works for angular applications not libraries.