Skip to content

[Regression]: directory-form tsconfig project references ("path": "../pkg") fail to resolve (fatal since 1.62)Β #41998

Closed as duplicate

Description

Last Good Version

1.61.1

First Bad Version

1.62.0

Steps to reproduce

Minimal layout (a tsconfig that references a sibling project by directory, as tsc --build and nx sync write it):

repro/
β”œβ”€β”€ package.json            # devDependencies: { "@playwright/test": "1.62.0" }
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ sub/
β”‚   └── tsconfig.json       # any valid tsconfig, e.g. {"compilerOptions": {"composite": true}}
β”œβ”€β”€ playwright.config.ts    # export default {} is enough
└── example.spec.ts

tsconfig.json:

{
  "compilerOptions": { "composite": true },
  "references": [{ "path": "./sub" }]
}

example.spec.ts:

import { test, expect } from '@playwright/test'
test('passes', () => expect(1).toBe(1))

Then:

npm install
npx playwright test

On 1.62.0 this exits 1 with:

Error: Failed to load tsconfig file at <repro>/tsconfig.json:
Failed to resolve "references" path "./sub" referenced from <repro>/tsconfig.json

Downgrading confirms the regression:

npm i -D @playwright/test@1.61.1
npx playwright test   # 1 passed

Meanwhile tsc --build resolves the same tsconfig without complaint: per the TypeScript project references docs, a references.path may point at a directory containing a tsconfig.json file and resolves to <dir>/tsconfig.json.

Expected behavior

Playwright resolves {"path": "./sub"} to ./sub/tsconfig.json, the same way tsc does, and the tests run.

Actual behavior

resolveConfigFile() in packages/playwright/src/transform/tsconfig-loader.ts unconditionally appends .json to any path not ending in .json, so ./sub becomes ./sub.json, which does not exist. Up to 1.61 this mis-resolution was silently swallowed (innerLoadTsConfig returned an empty config for the missing file). Since #41571 ("fail loudly when extends/references can't be resolved", first shipped in 1.62.0) the missing file is a hard error, so every project using the standard directory form β€” which is what tsc --init-era docs and nx sync produce β€” now fails at config load, even when the referenced projects are irrelevant to the tests.

Related but distinct: #41989 also bisects to #41571, but every case there is an extends bare specifier (a package name such as foo/tsconfig.json, @repo/tsconfig/next, or typescript-config-silverwind), and the remedies discussed there (walking up node_modules, or require.resolve to honor exports maps) are Node-style package resolution. This report involves no packages and no node_modules: the path is a plain relative directory, and the missing behavior is TypeScript's rule that a references.path pointing at a directory resolves to <dir>/tsconfig.json. require.resolve('../storage-js') would resolve to the package's JS entry point, not its tsconfig, so a fix that fully resolves #41989 would leave this case failing. Both are resolver gaps that #41571 promoted from silent to fatal, so it may still make sense to fix them in one pass, but they need different resolution logic.

Real-world hit: supabase/supabase-js CI (packages/core/supabase-js/tsconfig.json has five directory-form references maintained by nx sync; playwright walks up to it from a test dir with no local tsconfig).

Workaround: place a minimal tsconfig.json next to playwright.config.ts so discovery stops before reaching the tsconfig with directory-form references (or run with --tsconfig= pointing at a reference-free config). Rewriting the references to explicit <dir>/tsconfig.json file paths also works, but tools like nx sync regenerate the directory form.

Additional context

No response

Environment

System:
    OS: macOS 26.5.2
    CPU: (10) arm64 Apple M4
    Memory: 251.14 MB / 24.00 GB
  Binaries:
    Node: 22.22.2 - /Users/fileas/.nvm/versions/node/v22.22.2/bin/node
    npm: 10.9.7 - /Users/fileas/.nvm/versions/node/v22.22.2/bin/npm
    pnpm: 11.1.2 - /Users/fileas/Library/pnpm/bin/pnpm
    bun: 1.3.0 - /Users/fileas/.bun/bin/bun
    Deno: 2.9.1 - /opt/homebrew/bin/deno
  IDEs:
    VSCode: 1.130.0 - /Users/fileas/.local/bin/code
    Cursor: 3.13.10 - /usr/local/bin/cursor
    Claude Code: 2.1.220 - /Users/fileas/.local/bin/claude
  Languages:
    Bash: 3.2.57 - /bin/bash

Activity

  1. mandarini commented on Jul 27, 2026

    @mandarini
    Author

    Dmitry Gozman (@dgozman) I opened this separately from #41989 on purpose, as the two share a trigger but not a fix, and I tried to spell that out in the report. #41989 is about extends with bare package specifiers (foo/tsconfig.json, @repo/tsconfig/next): every failing case there is missing Node-style package resolution, and the remedies discussed (walking up node_modules, or require.resolve to honor exports maps) are all package-resolution fixes. This issue involves no packages and no node_modules at all. The failing path is a plain relative directory in references ({"path": "../pkg"}), and the missing behavior is TypeScript's rule that a reference path pointing at a directory resolves to <dir>/tsconfig.json. None of the fixes proposed in #41989 would touch it. require.resolve('../pkg') returns the package's JS entry point, not its tsconfig. So if #41989 is fixed exactly as scoped there, this case still fails on 1.62. Both regressions were made fatal by the same PR (#41571), so fixing them in one pass makes sense, but in that case could #41989 be retitled/broadened to cover directory-form references, so this case doesn't get lost? Otherwise I'd ask to reopen this one. Happy to provide a standalone repro repo if that helps.

  2. dgozman commented on Jul 27, 2026

    @dgozman
    Collaborator

    Katerina Skroumpelou (@mandarini) Thank you for the explanation! I will add this as a regression test as well, but the fix would be a revert anyway. Merging makes it easier for us to track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions