I'm building an angular library and got stuck trying to access package.json
file in the integrating app.
My purpose is to read the app-version variable from the integrating app.
this is what I thought:
import { version } from '../../../../../../package.json';
@Injectable({
providedIn: 'root'
})
export class AppVersionService {
private version: string = version;
getVersion() {
return this.version;
}
}
Logically I'm getting this error:
ERROR: error TS6059: File 'C:/.workspace/app-versioning/package.json' is not under 'rootDir' 'C:\.workspace\app-versioninge\projects\app-versioning\ng-core'. 'rootDir' is expected to contain all source files.
P.S: I need to load just the app-version variable into the browser, not the whole package.json
file.
Any Ideas, Thanks!