nrwl / nx

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

@nx/js:tsc --batch not working with dependsOn #27421

Closed uginroot closed 2 months ago

uginroot commented 2 months ago

Current Behavior

Targer build(@nx/js:tsc) has a pre-build dependency (nx:run-commands - buf generate), in this case the first step builds all packages that don't have pre-build @nx/js:tsc, and on the next steps all those that have pre-build dependency try to run, but crash at the stage of “building” their dependencies from package.json, although all these dependencies were already built on the first step.

Expected Behavior

I would like @nx/js:tsc --batch to work correctly with dependsOn option

Steps to Reproduce

  1. Create a project with dependencies on another internal project
  2. Add customizations to each roject to build via @nx/js:tsc
  3. Add a dependency to the project created at the first step in the dependsOn option
  4. Start building the project from the first step with the --batch option

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.16.0
OS     : linux-x64
yarn   : 3.6.1

nx             : 19.5.3
@nx/js         : 19.5.3
@nx/jest       : 19.5.3
@nx/workspace  : 19.5.3
@nx/devkit     : 19.5.3
@nrwl/tao      : 19.5.3
typescript     : 5.5.4

Failure Logs

TypeError: Cannot read properties of null (reading 'tsConfig')
    at generateTaskProjectTsConfig (/home/oem/work/project/nodejs-monorepo/node_modules/@nx/js/src/executors/tsc/lib/get-tsconfig.js:41:38)
    at generateTaskProjectTsConfig (/home/oem/work/project/nodejs-monorepo/node_modules/@nx/js/src/executors/tsc/lib/get-tsconfig.js:35:34)
    at getProcessedTaskTsConfigs (/home/oem/work/project/nodejs-monorepo/node_modules/@nx/js/src/executors/tsc/lib/get-tsconfig.js:10:9)
    at tscBatchExecutor (/home/oem/work/project/nodejs-monorepo/node_modules/@nx/js/src/executors/tsc/tsc.batch-impl.js:24:73)
    at tscBatchExecutor.next (<anonymous>)
    at runTasks (/home/oem/work/project/nodejs-monorepo/node_modules/nx/src/tasks-runner/batch/run-batch.js:44:47)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async process.<anonymous> (/home/oem/work/project/nodejs-monorepo/node_modules/nx/src/tasks-runner/batch/run-batch.js:71:29)

Operating System

leosvelperez commented 2 months ago

Thanks for reporting this!

I'm not sure I properly understand your described setup and that might be causing me not to reproduce the issue. Please provide a repro so we can troubleshoot this.

uginroot commented 2 months ago

@leosvelperez https://github.com/uginroot/ts-js-tsc-problem

github-actions[bot] commented 1 month ago

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.