Skip to content
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

Previous build is not cancelled on new build trigger #30247

Open
1 of 4 tasks
cberd1509 opened this issue Mar 3, 2025 · 0 comments
Open
1 of 4 tasks

Previous build is not cancelled on new build trigger #30247

cberd1509 opened this issue Mar 3, 2025 · 0 comments

Comments

@cberd1509
Copy link

cberd1509 commented Mar 3, 2025

Current Behavior

After upgrading to the latest Nx version, i'm seeing that in a NestJS project, when a file change is detected, the previous build is not being cancelled, seems like all the builds happen at the same time and that makes the console to lose format. So if multiple file changes are made and there are build in progress, they will overlap.

Normally it should be something like this

Image

But after a few concurrent restarts the console just starts outputting everything without line breaks.

Image

I've tried adding a debounce timer for the serve executor, or disabling cache and parallelism in the build executor but the issue persists.

For now i've only seen this behavior in NestJS/Webpack build, the monorepo contains an angular project which behaves just fine.

Expected Behavior

The builds should be triggered in sequence in case changes are done in multiple files, other than that, even if they run in parallel, the console should not lose format.

GitHub Repo

No response

Steps to Reproduce

  1. Create a NestJS project
  2. Perform changes in multiple files fast (I reproduced it by adding and removing console logs in a file and saving with Ctrl+Z)

Nx Report

Node           : 20.13.1
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 10.2.1

nx (global)        : 20.4.4
nx                 : 20.4.2
@nx/js             : 20.4.2
@nx/jest           : 20.4.2
@nx/eslint         : 20.4.2
@nx/workspace      : 20.4.2
@nx/angular        : 20.4.2
@nx/devkit         : 20.4.2
@nx/eslint-plugin  : 20.4.2
@nx/nest           : 20.4.2
@nx/node           : 20.4.2
@nx/web            : 20.4.2
@nx/webpack        : 20.4.2
typescript         : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/webpack/plugin
---------------------------------------
Community plugins:
@ngxs/storage-plugin : 19.0.0
@ngxs/store          : 19.0.0
apollo-angular       : 10.0.2
---------------------------------------
Local workspace plugins:
         @corememory/nx-prisma

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This is my current project.json, i added some options to see if i could debounce the builds but so far doesn't seem it is really using the debounce or the dependencies

{
  "name": "corememory-api",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/corememory-api/src",
  "projectType": "application",
  "tags": [],
  "targets": {
    "serve": {
      "executor": "@nx/js:node",
      "defaultConfiguration": "development",
      "options": {
        "buildTarget": "corememory-api:build",
        "watch": true,
        "debounce": 10000,
        "runtimeArgs": [],
        "waitUntilTargets": ["corememory-api:build"]
      },
      "configurations": {
        "development": {
          "buildTarget": "corememory-api:build:development"
        },
        "production": {
          "buildTarget": "corememory-api:build:production"
        }
      }
    },
    "build": {
      "options": {
        "cwd": "apps/corememory-api",
        "args": ["--node-env=production"],
        "command": "webpack-cli build"
      },
      "cache": false,
      "dependsOn": ["^build"],
      "inputs": [
        "production",
        "^production",
        {
          "externalDependencies": ["webpack-cli"]
        }
      ],
      "outputs": ["{workspaceRoot}/dist/apps/corememory-api"],
      "metadata": {
        "technologies": ["webpack"],
        "description": "Runs Webpack build",
        "help": {
          "command": "pnpm exec webpack-cli build --help",
          "example": {
            "options": {
              "json": "stats.json"
            },
            "args": ["--profile"]
          }
        }
      },
      "executor": "nx:run-commands",
      "configurations": {},
      "parallelism": false
    },
    "test": {
      "executor": "@nx/jest:jest",
      "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
      "options": {
        "jestConfig": "apps/corememory-api/jest.config.ts"
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant