When linking the dist folder created by 'ng-packagr -p ng-package.json'. It throws a runtime error 'Unexpected value 'MyModule' imported by the module 'AppModule'. Please add a @NgModule annotation.' When publishing the same dist folder to npm and installing it, it does not give any errors.
Copying the files from the dist folder to the apps node modules works but this is not a solution that we want to pursue.
Run 'ng-packagr -p ng-package.json'. Link the dist folder by doing yarn link. Now go to the app that want to use the library and use yarn link my-library.
Expected behaviour yarn link would give the same results as publishing to npm repo (for local development).
ng-packagr: v1.2.0
node: v7.10.0
@angular: v4.2.4
rxjs: 5.4.2
zone.js: 0.8.14
For anyone else seeing this issue with Angular CLI, you have to launch ng serve with preserve symlinks like this:
ng serve --preserve-symlinks
I am using @angular/[email protected]
@matt328 Thanks for the answer. This indeed works 馃憤 Angular CLI should really add this to their documentation.
yeah the current cli story for using linked libs doesn't mention the flag.
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._
Most helpful comment
For anyone else seeing this issue with Angular CLI, you have to launch ng serve with preserve symlinks like this:
I am using @angular/[email protected]