-
Notifications
You must be signed in to change notification settings - Fork 12k
Library's non-TypeScript files' changing will not reflect on UI even if ng serve
recompiled
#17736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Indeed this is a duplicate of #13588, I believe that it is fixed by Ivy. |
@alan-agius4 I should set Ivy to false, for two reasons, the first one is that Angular official still do not recommend library to be bundle with Ivy way (mentioned in docs), and another is our project is still under the migrating from Angular v8. However, I think the second one can be ignored though in the near future. But as you mentioned in that issue, is there any other way to solve it with non-Ivy development? Thx! |
@hijiangtao, If you are not using Ivy, you can disable AOT during development and you shouldn’t hit this issue. While we do recommend not to ship Ivy libraries to NPM, we do recommend using Ivy for library builds during development. In your case however, it will not be possible since you are still using VE in your application. |
@alan-agius4 I tried two approaches, but still got the problem.
In this case, I have such configurations both in my library's
and I run build and serve with
I got warnings like
I am not sure if I did something wrong with the configurations that you recommend? I think I could put my codes out, with library codes in https://github.com/hijiangtao/fudao-hello and host project codes in https://github.com/hijiangtao/ngrx-store-example. The above tsconfig.json shows in:
I tried to set
So I opened the And one more thing, changes in library's TypeScript files are normal all the same. |
And I found a pull request that may be relevant to this problem, and I see it's status is still open, could it be the problem? #15146 I found an issue #16272 discussed about the style files's no change problem, but it also said it's been fixed in 9.0.0-rc.4, I tried to switch angular-cli to that version, but it didn't work for me either. (The above operations is under |
One more thing is that, even if I can see the changes in TypeScript files shows in pages, the
It's another wired thing. |
Hi @hijiangtao, It seems that the Chinese version of documentation is not up to date. in the English version https://angular.io/guide/aot-compiler#choosing-a-compiler, the documentation states that since version 9, AOT is the default for new applications. So in your case, while you are not using Ivy, you are still building in AOT https://github.com/hijiangtao/ngrx-store-example/blob/acb7dc452f7a52a51286ded52508f2de5b36fc3e/angular.json#L25 When not using Ivy, AOT compilation are not recommended to be used during development as incremental builds are much slower, thus you should set the AOT option to Regarding to the open PR to solve this library consumption incremental builds #15146, indeed that does solves the problem, but that was a workaround to a larger issue. And since the old VE rendering engine is deprecated and AOT compilations during development are mainly recommended to be used with Ivy. That fix will not longer be landed. On a separate note, my recommendation for a better development experience, is to have multiple projects in the same repo (aka: monorepo), which the Angular CLI supports out of the box and is the official supported development workflow.
|
Thanks for replying, @alan-agius4 , I look through docs again and change AOT option to And on the other hand, I think my project will migrate to Angular v9+ finally, so I tried the Ivy build way again. I simply change the property in "angularCompilerOptions" of
And could I simply regard the words "development" here as something that works the same as Last, for the development experience, we truly considered organizing libraries and projects in one repo before, but we prefer separate them into different repos after Googleing some solutions: How to cooperate between teams?
In order to separate them to a more maintainable state, and don't lose the good workflow of developing and debugging, we use We are looking for a better development experience all the time, but as far as we know, something like micro frontend mechanism would be one of the best solution right now. We would love to try something new (we are in the beginning of the repo-separating works) if you have any good advice on it. Thanks again for your detailed and good explanation, again! |
Hi again,
Note: I don't recommend using
IMHO, when having a monorepo it's very important that you split and structure it well, as otherwise you indeed will find it hard to work with. I worked in various environments, ie: using a single mono repo, multiple mono repos, and single projects repo. For me, a single mono repo always wins over all the other setups and I know live by the mantra of mono-repo everything, because for me the benefits are way too big compared to the cons. Especially when want to test changes or do changes across the board like for example updating TypeScript or Angular. Having a monorepo, doesn't constrain you from having micro-frontends, that said, currently the Angular CLI doesn't have a micro-frontend story and you are venturing in unsupported territory.
While indeed the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
It will occurs in several angular-cli's version, from v6 to v9.
Description
I use Angular CLI: 9.0.7 in developing my project
excellent-proj
, and it has a dependency, let's call it@hello
.When I want to modify codes in
@hello
and debug it insideexcellent-proj
, a cooling workflow should be that I only need to write codes in@hello
and webpack-dev-server should detects the changing, then rebuild the@hello
and refresh it also inexcellent-proj
.I tried following way to make it works:
yalc
to organize library's publish and updates' pushing (from library project toexcellent-proj
project);@hello
with something likenodemon -x 'ng build hello && yalc push'
;excellent-proj
withyalc add @hello
andng serve
;I can confirmed updates triggered library's rebuilding and the new codes can be found in
excellent-proj
, but something wired is only changes in library's TypeScript files can be seen in pages, changes in html and styles files remains the old ones.🔬 Minimal Reproduction
Just init a Angular project and an Angular library with
angular-cli
, and then add the library to project's dependency.In order to confirm this is not a problem of third-library like
yalc
, I also tried following steps, and you can do too:ng build --watch
in@hello
project;ng serve
inexcellent-proj
project;@hello
, it will triggered@hello
's rebuild, and then I moveddist/hello
toexcellent-proj
'snode_modules/@hello
folder;🔥 Exception or Error
The above steps will definitely triggered Angular
ng serve
's recompiling work, since I got following info when I copy it into project's folder (I also triednpm link
way too):But the disappointed thing is that only changes in TypeScript file reflects in UI, not the html files and style files.
It shouldn't be the problem of my wrong usage of
ng build
orng serve
or somethiing likecp -r folderA/ folderB/
, since I can see the new content inside project and TypeScript's changing logic, but just without html and style's changing...:-(
🌍 Your Environment
Anything else relevant?
I searched many issues, like with angular-cli v6, v7, v8 and also v9, such as #2389, #8168, #2356, I think #13588 issue is mostly the same as mine, however, it still remains open after more than one year.
It seems like an existing issues that not been resolved yet, is it a problem that is still under considered by your team? Or is it a bug basically of
angular-cli
?Thanks in advance.
The text was updated successfully, but these errors were encountered: