Skip to content

Library build support: missing ɵcmp ivy declarations in .d.ts output #86

@schplitt

Description

@schplitt

First off, really impressive work on the compiler. The compilation speed is noticeably faster and the Vite integration feels great to work with.

I've been trying to use @oxc-angular/vite to build and publish an Angular component library via tsdown. I'm aware this is not the intended use case since the plugin is designed for Vite, but as it exposes a rollup-compatible plugin interface I hoped it would carry over to rolldown-based library builds too, and the JS output actually works perfectly: ɵcmp is correctly emitted.

However the .d.ts files are generated by plain tsc, which has no knowledge of Angular's ivy compiler, so consumers get:

Component imports must be standalone components, directives, pipes, or NgModules. (-992012)

because ɵɵComponentDeclaration<...> is missing from the type declarations entirely.

I put together a minimal repro: schplitt/oxc-angular-lib-dts-reproduction

npm install && npm run build shows the mismatch immediately. dist/index.js has ɵcmp, dist/index.d.ts does not.

The fix would require either:

  • a post-processing step that emits ivy .d.ts shims alongside the bundled output
  • or a compilationMode: 'partial' option for library builds (similar to what ng-packagr does via ngtsc)

Is library build support in scope, or is this intentionally out of bounds for this project?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions