I’m building a plain Node-based utility (not an Angular application) that uses the @angular/compiler-cli package directly. When I try to import readConfiguration, TypeScript reports that it’s not exported.
Module '"@angular/compiler-cli"' has no exported member 'readConfiguration'.ts(2305)
I’ve created a minimal repro—either clone the repo or follow the steps below to see the TS error.
Reproduction
Option A: Clone the repo
git clone https://github.com/wizardnet972/nx-tsapp
cd nx-tsapp
pnpm install
Then open packages/builder/src/lib/builder.ts in your editor; the import there triggers the error:
import { readConfiguration } from '@angular/compiler-cli';
// ~~~~~~~~~~~~~~~~~~
// Module '"@angular/compiler-cli"' has no exported member 'readConfiguration'.ts(2305)
Option B: Manual setup
Create a new directory and initialize:
npx create-nx-workspace@latest --pm pnpm --name nx-tsapp Which stack do you want to use? · none ... cd nx-tsapp pnpm nx g @nx/js:library --directory=packages/builder --bundler=vite --linter=eslint --publishable=true --unitTestRunner=vitest NX Generating @nx/js:library Fetching @nx/vite... Fetching @nx/eslint... CREATE packages/builder/src/lib/builder.ts ... CREATE packages/builder/eslint.config.mjs CREATE .verdaccio/config.yml Scope: all 2 workspace projects $ pnpm approve-builds $ pnpm add @angular/compiler-cli ... dependencies: + @angular/compiler-cli ^20.1.0 ... Done in 2.8s using pnpm v10.13.1Create
builder.ts:import { readConfiguration } from '@angular/compiler-cli'; // ~~~~~~~~~~~~~~~~~~ // Module '"@angular/compiler-cli"' has no exported member 'readConfiguration'.ts(2305)
What I’ve Tried
- Installed the latest
@angular/compiler-cli@^20.1.0. - Inspected
node_modules/@angular/compiler-cli/index.d.ts—noreadConfigurationexport. - Located
readConfigurationin the source undersrc/perform_compile.ts. - I suspect this happens because
index.d.tsrefers to files under./src, which aren’t present in the installed package layout under PNPM.
Why isn’t readConfiguration exposed in the public API of @angular/compiler-cli? how to solve it?