Repository navigation
fix(vite): add Ivy members to .d.ts chunks - #683
Open
benjavicente wants to merge 1 commit into
Open
benjavicente wants to merge 1 commit into
benjavicente wants to merge 1 commit into
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
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.Tests
dts.test.ts: a.d.mtschunk gets the members, and JavaScript chunks are left alone.ɵcmpand the consumer app compiles.Reproduction: https://github.com/benjavicente/oxc-angular-repro-dts-chunks