We currently trying to build our next library on angular 9 with Ivy. We have two projects: one corresponding to our library of components, the second corresponding to a " demo " that is used to document/test them. Demo calls the library through node_modules where the library is linked with a symlink.
When we finished to install dependencies of demo, we need to perform: " ngcc && ngcc -s node_modules/ourLibrary --create-ivy-entry-points " to create each ivy_ngcc dir and make our application working.
We can now npm start our demo and live-reload changes. When we make changes into our library and we ng build, it does not automatically trigger changes. If we cut the npm start and restart it, the application launch without error in the terminal, but in the browser console we have: Cannot read property 'id' of undefined. All it's working again if we run ngcc -s node_modules/ourLibrary --create-ivy-entry-points
What happens? When we build again our library, nothing change cause angular probably watch for ivy_ngcc changes : the build generated erase the ivy_ngcc and after the doc doesn't succeed to find it: " Cannot read property 'id' of undefined ". It's why when we re-run the ngcc command, it recreates the dir. But each process it's very time-consuming.
My question is: is there a way to preserve ivy_ngcc during the build of the library? Is the unique solution is to disable ivy that probably not feet our needs?
For information, live-reload with library on a project work very well on angular 7
-- EDIT 1 --
We can probably use --delete-output-path in ng build of the library to try to preserve ivy_ngcc folder, but the option appear to not be available anymore ?
-- EDIT 2 --
--delete-output-path don't work for libraries :
https://github.com/angular/angular-cli/issues/13274
We probably could make our own build command instead of using ng build, but it's become complicated for few benefit of ivy.