From 9700ae507f4019279069eca3acbf490913760263 Mon Sep 17 00:00:00 2001 From: arturovt Date: Mon, 30 Mar 2026 23:21:48 +0300 Subject: [PATCH] fix: support Angular CLI 21.2.x findUpSync rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Angular CLI 21.2, the synchronous findUp utility was renamed to findUpSync, making the old findUp async. Importing findUp statically then passing its return value (now a Promise) as a file path caused: "The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Promise." Replace the static import with a runtime require that prefers findUpSync (21.2+) and falls back to findUp (≤21.1), keeping compatibility across both CLI ranges without breaking existing behaviour. --- libs/single-spa-community-angular/webpack/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/single-spa-community-angular/webpack/index.ts b/libs/single-spa-community-angular/webpack/index.ts index 3f172e3..5761221 100644 --- a/libs/single-spa-community-angular/webpack/index.ts +++ b/libs/single-spa-community-angular/webpack/index.ts @@ -1,5 +1,10 @@ import * as fs from 'fs'; -import { findUp } from '@angular/cli/src/utilities/find-up'; + +// Angular CLI 21.2+ renamed the sync variant to `findUpSync`; ≤21.1 only exports `findUp` (sync). +// We load both at runtime and prefer `findUpSync` so the code works across both ranges. +// eslint-disable-next-line @typescript-eslint/no-var-requires +const { findUpSync: _findUpSync, findUp: _findUp } = require('@angular/cli/src/utilities/find-up'); +const findUp: (names: string | string[], from: string) => string | null = _findUpSync ?? _findUp; import { externals } from './externals'; import { removeMiniCssExtractRules } from './webpack-5/remove-mini-css-extract';