Closed iRoyPeleg closed 2 weeks ago
Hey @iRoyPeleg :)
I'm going to need you to provide a repo with a reproduction.
You can see I have an app that depends on a buildable library here, have buildLibsFromSource: true
and I can't reproduce it
https://github.com/Coly010/nx27081.git
The NxWebpackBuildCoordinationPlugin
also shouldn't be set up when buildLibsFromSource
is set to true
.
@Coly010 , you are of course 100% correct.
Obviously I ment buildLibsFromSource: false
, for some reason I switched it up in my head and wrote it all over the ticket the other way around, now edited it.
If buildLibsFromSource: true
, no actual libraries needs to be built anyhow, so of course it's the false
scenario, again, my bad.
I wanted to verify it on your reproduction, but it appears in your repo it's only the app, no libs inside? maybe you've done it locally and didnt push. There are more discrepancies in that repo (like it's not the webpack variant in the build executor), but I assume it's just not pushed and locally it's configured correctly.
In case you do have a build locally on your end and just need to turn the buildLibsFromSource: false
flag, that'll be great, otherwise I'll try to recreate it via a new repo.
Thank you very much!
This issue has been automatically marked as stale because no reproduction was provided within 7 days. Please help us help you. Providing a repository exhibiting the issue helps us diagnose and fix the issue. Any time that we spend reproducing this issue is time taken away from addressing this issue and other issues. This issue will be closed in 21 days if a reproduction is not provided. If a reproduction has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Hi @Coly010 !
I've reproduced the issue: https://github.com/iRoyPeleg/nx27081
run nx serve myapp
and then alter the app.component.html
to see mylib
being rebuild as well.
Thanks!
Hey @iRoyPeleg Thanks for the reproduction! Very much appreciated.
After checking this out on the reproduction, I can see that it does build when you make a change to app.component.html
, however, I can also see that it will fetch this build
from cache, if the library itself (or its dependents) have not changed
Therefore this doesn't add much overhead to the rebuild on app change. This is working as we'd expect it to (reading from cache when possible).
This might not be what you expected, but I'm going to close this issue as there is no bug here. I hope the information above helps to explain the additional build logs you see.
Current Behavior
In an Angular project, if
buildLibsFromSource
is set tofalse
, and you are running an application with eitherbuild --watch
orserve
with a webpack-browser configuration, all the workspace libraries that the application depends on will always rerun build.This is due to this part of the code in
webpack-browser.impl.ts
&dev-server.impl.ts
in the angular package:What happens here, is that you use the
WebpackNxBuildCoordinationPlugin
, which then runs thenx run-many
command on every change that is being made in the application.The problem is even more evident in
serve
, where if you make a change in the application, the app compiles and outputs a delta change - and then all the libraries are still being rebuilt after the application was "already rebuilt".Thanks.
Expected Behavior
During either
build --watch
orserve
, if an app depends on libraries, but they have not changed - the build process for said libraries should not be retriggered.Only the
delta
changed libraries should be triggered, and in the correct order.GitHub Repo
No response
Steps to Reproduce
webpack
based implementationbuildLibsFromSource: false
for the applicationproject.json
build --watch
or viaserve
Here you will see the library recompiles again.
Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response