nx
nx copied to clipboard
Parallel targets
- [ x ] I'd be willing to implement this feature (contributing guide)
Description
When running serve
command for a library with implicitDepndencies
I'd sometimes want to use dependsOn: ["^serve"]
in order to serve
the implicit deps for a smooth developer experience.
The problem is that the serve
of the implicit deps is also watching, so it never stops, hence the original serve
doesn't run.
Adding a parallel functionality to dependencies can solve this issue.
Motivation
Running multiple serve levels for implicitDepndencies
.
Suggested Implementation
Add a targetDependenciesInParallel
option that will trigger the other targets in parallel.
Alternate Implementations
Build a dedicated serve
mechanism that will do the following:
- Run the dependable targets in parallel with the dependent target
- Optionally allow to state an output that marks "waiting for changes" in the dependable target that the dependent target will wait for before starting its own script.
Here's the workaround we currently use:
#on foo.project
{
"watch": {
"executor": "nx:run-commands",
"options": {
"command": "nx run foo:serve",
"readyWhen": "Started on http://localhost:4015/foo",
"parallel": true
}
}
Then in the main project, I change "^serve" to
^watch`. But we do have problems with parallel processes terminating at times.
As such, I would also be willing to collaborate with @YonatanKra in developing and testing of this feature.
Another alternative would be to biuld a "parallel" executor, that allows you to define child targets:
{
"targets": {
"foo": {
"executor": "@nx/parallel",
"options": {
"childTargets" : [{
"target": "bar:serve:development",
"reloadIfrunning": true,
"killOnExit": true
},
{
"target": "baz:watch:production"
}
],
@LongLiveCHIEF It's actually what I started building locally :) Before committing to a PR on Nx, I'd like feedback from maintainers to know what would be the best course of action for this (if any).
I'm interested in their thoughts as well. This has to have come up before.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This should still be in scope right?
I think this may be what you're looking for? #23273 Please contribute to the discussion there.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.