nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.53k stars 2.35k forks source link

Incorrect result after run task using dependsOn #22167

Closed klerick closed 1 week ago

klerick commented 7 months ago

Current Behavior

I have 3 task. The first task dependsOn from 2 other task If I run 2 and 3 run separately all work correct If I run first the result is incorrect. If I run 2 and 3 run separately after 1 the result is incorrect too.

image

Expected Behavior

Should be work correct

image

GitHub Repo

https://github.com/klerick/example-nx-issue

Steps to Reproduce

  1. the first task
    "build": {
      "executor": "nx:run-commands",
      "dependsOn": ["build-mjs", "build-cjs"],
      "options": {
        "commands": [
          "echo 1"
        ],
        "cwd": "./",
        "parallel": false
      }
    },
  2. the second task
    "build-cjs": {
      "executor": "@nx/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/libs/test-bug/cjs",
        "main": "libs/test-bug/src/index.ts",
        "tsConfig": "libs/test-bug/tsconfig.lib.json",
        "assets": ["libs/test-bug/*.md"]
      }
    },
  3. the third task
    "build-mjs": {
      "executor": "@nx/js:tsc",
      "outputs": ["{options.outputPath}"],
      "options": {
        "outputPath": "dist/libs/test-bug/mjs",
        "main": "libs/test-bug/src/index.ts",
        "tsConfig": "libs/test-bug/tsconfig-mjs.lib.json",
        "assets": ["libs/test-bug/*.md"]
      }
    }

    4 run the first task

Nx Report

Node   : 18.14.1
OS     : darwin-arm64
npm    : 9.3.1

nx                 : 18.0.7
@nx/js             : 18.0.7
@nx/jest           : 18.0.7
@nx/linter         : 18.0.7
@nx/eslint         : 18.0.7
@nx/workspace      : 18.0.7
@nx/angular        : 18.0.7
@nx/cypress        : 18.0.7
@nx/devkit         : 18.0.7
@nx/eslint-plugin  : 18.0.7
@nrwl/tao          : 18.0.7
@nx/web            : 18.0.7
@nx/webpack        : 18.0.7
typescript         : 5.3.3

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏