Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicitly inferred type from another entry point generates wrong import pathes in compiled library #2403

Open
paulheising opened this issue Aug 16, 2022 · 1 comment
Labels

Comments

@paulheising
Copy link

paulheising commented Aug 16, 2022

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

Setup:

  • Library with at least two entry points, call them "entry2" and "entry3"
  • entry3 exports an interface
  • entry2 uses that interface (imports explicitly) in any file
  • Another file in entry2 references a value typed from the interface in entry3. Thanks to TypeScript type infering, the interface does not need to be imported in that file, as TypeScript can automatically infer the type from the assignment.
  • However what looks right and compiles fine leads to incorrect pathes in the compiled library: The d.ts file of the file containing the implicit reference to the interface looks something like this: "dist/entry2/interface"
  • This is a problem when publishing the library, because you won't have the library in that path when you installed it. This will lead to build errors in the consuming application

This appears to be a new problem in Angular 14 / ng-packagr 14

We used to have a setup like this for months now, and recently tried to upgrade to ng 14, which we can't until that bug is fixed or a workaround is found

How To Reproduce

See this demo repository, that contains a minimal reproduction example for the issue. You can find a setup similar to the one described above, only entry points "entry2" and "entry3" are relevant, just ignore the app and the main entry point of the lib

Expected Behaviour

The compiled library should always import from the public import path, like it used to did prior to ng 14

Version Information

ng-packagr:            14.1.0
@angular/compiler:     14.1.2
rollup:                2.78.0
typescript:            4.7.4
node: v16.16.0
npm: 8.11.0
@alan-agius4
Copy link
Member

This is very similar to #1405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants