Changes to npm linked library are not reflected to running angular cli app
Bug Report or Feature Request (mark with an x)
- [x] bug report -> please search issues before submitting
- [ ] feature request
Versions.
@angular/cli: 1.4.3 node: 8.4.0 os: darwin x64 @angular/animations: 4.4.3 @angular/common: 4.4.3 @angular/compiler: 4.4.3 @angular/core: 4.4.3 @angular/forms: 4.4.3 @angular/http: 4.4.3 @angular/platform-browser: 4.4.3 @angular/platform-browser-dynamic: 4.4.3 @angular/router: 4.4.3 @angular/cli: 1.4.3 @angular/compiler-cli: 4.4.3 @angular/language-service: 4.4.3 typescript: 2.3.4
Repro steps.
- Generate
my-projectwith angular-cli. - Clone
any-libfrom https://github.com/synctom/any-lib - Go to the
any-libpackage folder andnpm install&npm link - Go to
my-projectand run:npm link any-lib - Open
my-project/src/app/app.module.tsand paste this after the last import:
import { MyService } from 'any-lib';
const service: MyService = new MyService();
console.log(service.doSomething());
- Run
any-libwithnpm start - Run
my-projectwithng serve - All good
- Try to add a new function to MyService and try to call it in app.module.ts
- Function could not be found, unless you stop
ng serveand execute it again.
My solution so far
It's a caching issue located in a Webpack plugin that compiles the angular code.
Check @ngtools/webpack/src/plugin.js in the node_modules folder of your cli application.
Just remove or uncomment:
this._compilerHost.enableCaching();
After then, it works.
see https://github.com/angular/angular-cli/issues/6195
Heya, this seems to be a duplicate of #6195 (you even linked in in your comment). I appreciate your detailed reproduction but it's much better to keep the conversation in the same thread instead of having multiple issues for the same thing.
The solution you propose is not correct. Caching is essential for rebuild performance. It would drastically slow down rebuilds.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.