Repository navigation
fix(vite): add Ivy members to .d.ts chunks - #683
Merged
Brooooooklyn merged 2 commits intoNov 9, 2026
Merged
Conversation
The dts plugin only augmented declaration outputs of type `asset`, but rolldown-plugin-dts (and so tsdown) emits declarations as chunks. The published `.d.ts` then had no `ɵfac` / `ɵcmp` members, and Angular rejected the library's standalone components (NG2012: "Component imports must be standalone components, directives, pipes, or must be NgModules"). Augment `.d.ts` chunks through their `code`, and assets through their `source` as before. Fixes voidzero-dev#681
The README listed vite-plugin-dts and tsc as generators whose `.d.ts` get
augmented, but both write their files outside the bundle, after
`generateBundle`. tsdown's `.d.cts` for a `cjs` format is built in a
separate pass without user plugins. Say so, and fix the
rolldown-plugin-dts import (`{ dts }`).
Also read and write the chunk / asset text in one path, and test the
shared-chunk shape rolldown-plugin-dts emits (`declare class X` +
`export { X as t }`).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 9, 2026
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #681
Summary: the dts plugin only added the Ivy members (
ɵfac,ɵcmp, …) to.d.tsoutputs of typeasset. rolldown-plugin-dts (and so tsdown) emits declarations as chunks, so libraries built with it published plain classes and consumers failed withNG2012. This PR also augments.d.tschunks.Changes
vite-plugin/index.ts:.d.tschunks are augmented throughcode, and assets throughsourceas before.README.md: lists the declaration outputs that get the members (rolldown-plugin-dts, tsdown ESM) and those that don't:vite-plugin-dtsandtscwrite their files outside the bundle, and tsdown builds the.d.ctsofformat: 'cjs'in a pass without user plugins. Fixes therolldown-plugin-dtsimport ({ dts }). Support for those generators: dts: declarations from vite-plugin-dts, tsc and tsdown's .d.cts are not augmented #694.Tests
dts.test.ts: a.d.mtschunk gets the members, and JavaScript chunks are left alone.dts.test.ts: a shared chunk in rolldown-plugin-dts's shape (declare class X {}+export { X as t }) gets the members.ɵcmpand the consumer app compiles.Reproduction: https://github.com/benjavicente/oxc-angular-repro-dts-chunks
Known limits (older than this PR, now reachable through chunks; tracked separately)
.d.ts.mapis not updated after the members are added, so go-to-definition through a declaration map is off by the added lines (dts: declaration maps (.d.ts.map) are not updated after Ivy members are injected #693)..d.ts(Card/Card$1) can get the wrong members (dts: Ivy members are matched to classes by name only (wrong component metadata, renamedX$1left plain) #691).