question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AOT Compilation Error when importing Secondary Entry Points

See original GitHub issue

Type of Issue

[x ] Bug Report
[ ] Feature Request

Description

The following error is thrown when importing a secondary entry point in AOT mode.

ERROR in : Unexpected value ‘TestLabelModule in C:/Users/kkang/Sources/tester/tester/node_modules/@amat/theme/spinner/spinner.module.d.ts’ imported by the module ‘AppModule in C:/Users/kkang/Sources/tester/tester/src/app/app.module.ts’. Please add a @NgModule annotation.

How To Reproduce

  1. Create a library with secondary entry point.
  2. Import the component in another Angular project using the secondary entry point.
  3. Build using Angular CLI with --prod or --aot flag.
  4. Import the same component using the primary entry point, build will work without any errors.

I have created a testing repo which can be used to reproduce this issue: https://github.com/Karankang007/ng-packagr-testlib

import { TestLabelModule } from '@test/lib/label'; // Fails
import { TestLabelModule } from '@test/lib';          // Passes

Expected Behaviour

No compile or runtime errors in AOT mode.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            2.4.1
@angular/compiler:     5.2.9
@angular/compiler-cli: 5.2.9
rollup:                0.55.5
tsickle:               0.27.2
typescript:            2.5.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
thomaspinkcommented, Apr 24, 2018

We got a similar build like material (every component is its own module and a secondary entry point;) and moved now to a build using ng-packagr. This issue basically breaks the whole library when being used and build in a CLI project in AOT mode. Any updates on this issue?

6reactions
pieniazekcommented, Apr 24, 2018

@dherges Any updates on this? It’s currently a critical issue for us

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 AOT compilation failed - typescript - Stack Overflow
Important: Before separating the application by modules, the application worked well in production. The described problem appeared after ...
Read more >
AOT metadata errors - Angular
Angular generates a class factory in a separate module and that factory can only access exported classes. To correct this error, export the...
Read more >
Changelog | Burst | 1.6.6 - Unity - Manual
Fixed an internal compiler error when casting a void* to a pointer-to-vector and then access the element. Added. Burst now generates a link.xml ......
Read more >
Ninja Squad: Le Blog
the polyfills.ts file has been removed. The polyfills option in angular.json now directly accepts an array of imports. To add zone ...
Read more >
Angular 2 AOT Compilation - ANGULARarchitects
Notice the two entry points within the dist/unbundled-aot folder: the first points to the necessary polyfills and the second to the compiled ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found