library builder: tslib is not added to the output package.json
@alan-agius4 がすでに取り組んでいます。
2026年9月20日 から。
評価
この issue はまだ評価されていません。
説明
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Found while testing #34106 cc @alan-agius4
When emitted bundle imports tslib helpers and library's own package.json doesn't declare tslib, the built package declares none either. ng-packagr adds it, taking the range from @angular/compiler (^2.3.0 today). On ng-zorro-antd 34 of the 105 bundles import tslib and the library-builder output has no dependencies field at all.
With hoisting (plain npm, default pnpm) it resolves anyway. In a strict layout (pnpm with hoisting off) the consumer gets ERR_MODULE_NOT_FOUND ... 'tslib', and an app build fails to resolve it.
Minimal Reproduction
- a library with
importHelpers: true, target ES2022 and a standard decorator on a class, so TypeScript emits__esDecorate/__runInitializers - the library's package.json declares only a peer dependency on
@angular/core - build with both builders: both emit
import { __esDecorate, __runInitializers } from "tslib"into fesm2022 - ng-packagr's output package.json has
"dependencies": { "tslib": "^2.3.0" }, the library builder's has nodependencies - install the library-builder output in a non-hoisted layout and import it:
Cannot find package 'tslib'
Exception or Error
Your Environment
@angular/build built from #34106 (005e05ee) with the repo's own bazel build
Angular CLI 22.1.8
Angular 22.1.7
Node 24.16.0
npm 11.13.0
macOS 26.6, 14 cores, 24 GB
Anything else relevant?
ng-packagr does this in writePackageJson (write-package.transform.ts): if neither dependencies nor peerDependencies has tslib, it reads @angular/compiler's own range and writes it into dependencies. generatePackageManifests has no equivalent step. validateDependencies in build-action.ts already skips the tslib key when checking against allowedNonPeerDependencies, so the builder expects it to be there.
Declaring tslib in the library's own package.json works today and is carried through unchanged.
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 16時間 35分
- マージ済み PR(30日)
- 176
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular-cli のほかの issue
-
area: @angular/build gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/angular-cli#33055 · コメント 1 件 · リアクション 3 件 ·
-
area: @angular/build gemini-triaged
難易度 4/5 3〜5日 初心者へのやさしさ 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 担当者 1 名 ·
angular/angular-cli の issue をすべて見る
似ている issue
-
Browser Waiting for: Product Owner
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
getsentry/sentry-javascript#24577 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
agilepathway/label-checker#640 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
anomalyco/models.dev#7701 ·