-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(webpack): WebpackNxBuildCoordinationPlugin cancels inflight builds on new changes detected #18883
fix(webpack): WebpackNxBuildCoordinationPlugin cancels inflight builds on new changes detected #18883
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
} finally { | ||
this.currentlyRunning = 'none'; | ||
} | ||
}).then(() => { | ||
this.currentlyRunning = 'none'; | ||
this.buildCmdProcess = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures webpack will wait until the build of dependent projects has completed before continuing the webpack build
packages/webpack/src/plugins/webpack-nx-build-coordination-plugin.ts
Outdated
Show resolved
Hide resolved
if (this.buildCmdProcess) { | ||
this.buildCmdProcess.kill(2); | ||
this.buildCmdProcess = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If new changes are detected, kill the current process running the build allowing the Promise to resolve, allowing the next item in the queue to be processed.
Consideration: An API for the BatchFunctionRunner
to clear the queue before queuing a new build. There could be a potential issue where we have 3 builds queued, we detect changes, and we only cancel the first build, but there are still builds queued.
However, I haven't been able to produce this scenario in testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but can you check just changing the return new Promise
to return await new Promise
?
…s on new changes detected
e1ccd6e
to
e0cc3b0
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When changes occur quickly in succession, builds are queued, and processed synchronously.
An action such as changing between two branches quickly could lead to a long wait time as the previous build must be completed before the second build occurs.
Webpack also continues to build the application before the dependent projects have finished building.
Expected Behavior
Webpack should wait for the dependent projects to finish building before attempting to build the application.
When a build is currently in progress, if more changes are detected, the initial build should be cancelled, allowing the queue to start to process the next items.
Related Issue(s)
Fixes #