InjectionToken not included in metadata
See original GitHub issueType of Issue
[x ] Bug Report
[ ] Feature Request
Description
I am exporting the following InjectionToken export const SX_NGX_FABRIC_DIALOG_DATA = new InjectionToken<any>('SxNgxFabricDialogData');
When I run ng-packagr, the InjectionToken is not included in the metadata.json file which resulted in the following error Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler
when building with the following flags ng build --prod --aot --sourcemaps --build-optimizer --named-chunks --stats-json
How To Reproduce
Add an InjectionToken in you library, run ng-packagr and try to use that injection token in the app that refereneces the library. Project can be found here: https://github.com/Abrissirba/sx-ngx-fabric
Expected Behaviour
The injection token should be included in the metadata.json
Version Information
ng-packagr: v2.0.0-rc.3
node: v8.x.y
@angular:
rxjs: "^5.5.2",
zone.js: "^0.8.14"
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
A bit more insight, and a workaround from #720 as applied to my case: Apparently the issue is that - for whatever reason - the first entry point must be a direct reference to the barrel file, rather than the directory it lives in. This cascades - so if your
public_api.ts
is a barrel file, which itself imports from directories, the metadata won’t be constructed properly.The workaround for this issue is: Always refer barrel files directly, don’t use directory resolution.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.