Skip to content

fix(compiler): resolve an absolute tsconfig path - #3620

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
KAPUIST:fix/compiler-absolute-tsconfig-path
Oct 12, 2026
Merged

kamilmysliwiec merged 1 commit into
nestjs:masterfrom
KAPUIST:fix/compiler-absolute-tsconfig-path

Conversation

@KAPUIST

@KAPUIST KAPUIST commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

  • The commit message follows the contribution guidelines.
  • Regression tests have been added.
  • Docs have been added / updated (not applicable; no public API change).

PR Type

  • Bugfix

What is the current behavior?

Issue Number: N/A

An absolute tsconfig path fails for every builder:

$ nest build -p "$PWD/tsconfig.json"
Error  Could not find TypeScript configuration file "/home/me/app/tsconfig.json".

TsConfigProvider builds the path with join(process.cwd(), configFilename), which appends an absolute path to the working directory. BuildAction calls the provider before it selects a builder, so the command stops there. This is also why the absolute-path case described in #3595 (webpack) and fixed in #3542 (rspack) still cannot be reached from the command line.

What is the new behavior?

The provider uses resolve, which keeps an absolute path as it is. Relative paths resolve as before.

Does this PR introduce a breaking change?

  • No

Other information

Validated on macOS with Node 24.21.0:

  • The new unit test fails with the error above before the fix and passes after it.
  • Full unit suite: 88 files, 1,080 tests passed. npm run build, npm run lint and the Prettier check on the changed files passed. Lint reports the existing unused yellow import in runner.factory.ts.
  • Actual nest build -p <absolute path> produced the output with the tsc, swc, webpack and rspack builders, and nest start --watch -p <absolute path> started the application. A relative path still builds.

The test:e2e suite and Windows were not run locally.

TsConfigProvider joined the given path onto the working directory, so an
absolute path (e.g. `nest build -p /app/tsconfig.build.json`) pointed at
a file that does not exist and every builder failed with "Could not find
TypeScript configuration file".
@kamilmysliwiec
kamilmysliwiec merged commit 9280699 into nestjs:master Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants