fix(angular): fix import from ng-packagr (#31600)

## Current Behavior

Using the `ng-packagr` executors in an Angular version lower than v20
results in an error due to a bad import.

## Expected Behavior

The `ng-packagr` executors should work correctly regardless of the
Angular version used.

## Related Issue(s)

Fixes #31597
This commit is contained in:
Leosvel Pérez Espinosa 2025-06-16 10:20:13 +02:00 committed by GitHub
parent db86a355c6
commit bf9c677e79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,8 +9,9 @@
import { workspaceRoot } from '@nx/devkit';
import browserslist from 'browserslist';
import { existsSync } from 'fs';
import { colors } from 'ng-packagr/src/lib/utils/color';
import { dirname, join } from 'path';
import { getNgPackagrVersionInfo } from '../ng-packagr-version';
import { importNgPackagrPath } from '../package-imports';
const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
const maxThreads =
@ -100,6 +101,10 @@ export class StylesheetProcessor {
]);
const tailwindConfigPath = findTailwindConfiguration(searchDirs);
const { major: ngPackagrMajorVersion } = getNgPackagrVersionInfo();
const { colors } = importNgPackagrPath<
typeof import('ng-packagr/src/lib/utils/color')
>('ng-packagr/src/lib/utils/color', ngPackagrMajorVersion);
const Piscina = getPiscina();
this.renderWorker = new Piscina({