Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

angular-query: migrate-from-experimental schematic crashes with 'Path ... is a file' on a .js subpath import

Offen
#12,032 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@imaksp arbeitet bereits daran.

Seit 15.10.2026.

  • #12033 von @imaksp — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
angular, typescript
Bereich
devtools

Rechercherichtung

The crash comes from the compiler host built in configuredSources() in packages/angular-query/schematics/migrate-from-experimental/workspace.ts, where directoryExists calls tree.getDir(path) on paths that can be files. Read that host and how the devkit Tree reports files versus directories, then reproduce with the linked repro and a source importing a .js subpath such as @noble/hashes/sha3.js. Done means the dry run lists the expected UPDATE entries instead of throwing, with a regression test in the schematic's test suite. The reporter says they plan to open the PR themselves, so confirm with them before starting.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Describe the bug

The migrate-from-experimental schematic in @tanstack/[email protected] aborts before migrating anything when a project source imports a package subpath that names a file, such as import { sha3_256 } from '@noble/hashes/sha3.js':

Path "/node_modules/@noble/hashes/sha3.js" is a file.

The cause is the compiler host built in configuredSources() (packages/angular-query/schematics/migrate-from-experimental/workspace.ts). Its directoryExists calls tree.getDir(path) directly. TypeScript's module resolution probes candidate paths with directoryExists, and some of them are files. The devkit Tree.getDir() then throws PathIsFileException rather than reporting that no directory exists.

Your minimal, reproducible example

https://github.com/imaksp/tanstack-angular-query-migrate-schematic-repro

Steps to reproduce
  1. Clone the repro and run pnpm install.
  2. Run pnpm exec ng generate @tanstack/angular-query:migrate-from-experimental --dry-run.
  3. See Path "/node_modules/@noble/hashes/sha3.js" is a file.

It also reproduces with an npm-style flat layout (pnpm install --config.node-linker=hoisted). Removing the @noble/hashes/sha3.js import makes the dry run succeed.

Expected behavior

The schematic migrates the workspace: the dry run lists UPDATE src/main.ts and UPDATE package.json. Instead it throws, and none of the project's files are migrated. In a real workspace, every file is skipped as soon as one source imports such a subpath.

How often does this bug happen?

Every time

Platform
  • OS: macOS 26
  • Node: 26.8.2
  • pnpm: 12.9.1
  • Angular CLI: 22.2.1
Tanstack Query adapter

angular-query

TanStack Query version

5.0.0-rc.3

TypeScript version

6.0.3

Additional context

Making directoryExists return false for a path that is a file fixes it. tree.exists() is true only for files:

host.directoryExists = (path) => {
  if (tree.exists(path)) return false
  const directory = tree.getDir(path)
  return directory.subfiles.length > 0 || directory.subdirs.length > 0
}

With that change the repro's dry run succeeds. I'll open a PR with the fix and a regression test.

Vorherrschende Sprache
TypeScript
Sterne
50.4k
Forks
4.2k
Ø Merge
8 Std. 51 Min.
Gemergte PRs (30 T.)
432

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TanStack/query

Alle Issues in TanStack/query

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.