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

ng2-pdf-viewer breaks the AOT build with Angular CLI 1.5.0 #196

Closed
rsheptolut opened this issue Nov 6, 2017 · 1 comment
Closed

ng2-pdf-viewer breaks the AOT build with Angular CLI 1.5.0 #196

rsheptolut opened this issue Nov 6, 2017 · 1 comment
Assignees
Labels
Milestone

Comments

@rsheptolut
Copy link

rsheptolut commented Nov 6, 2017

Updated the Angular version to 5.0 in my existing project and it stopped working.
Just importing and adding PdfViewerComponent to declarations of an Angular 5 module leads to an error when compiling with Angular CLI 1.5 with --aot:

ERROR in TypeError: Cannot read property 'annotation' of null
    at CompileMetadataResolver.loadDirectiveMetadata (C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:14787:109)
    at C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:15073:54
    at Array.forEach (native)
    at CompileMetadataResolver.loadNgModuleDirectiveAndPipeMetadata (C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:15072:41)
    at C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:29416:69
    at Array.forEach (native)
    at C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:29415:35
    at Array.forEach (native)
    at AotCompiler.loadFilesAsync (C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler\bundles\compiler.umd.js:29414:15)
    at C:\Projects\Cat\turbo\turbo-ui\node_modules\@angular\compiler-cli\src\transformers\program.js:145:35
    at process._tickCallback (internal/process/next_tick.js:109:7)

Tested with 1.1.1 and 2.0.3.
Also there's an issue in Angular CLI repo.

And when you just import the PdfViewerComponent and don't add it to declarations, you get this error.

When I remove the import completely, the project gets compiled and works just fine.

@rsheptolut rsheptolut changed the title ng2-pdf-viewer doesn't work with Angular 5.0 ng2-pdf-viewer breaks the AOT build with Angular CLI 1.5 Nov 6, 2017
@rsheptolut rsheptolut changed the title ng2-pdf-viewer breaks the AOT build with Angular CLI 1.5 ng2-pdf-viewer breaks the AOT build with Angular CLI 1.5.0 Nov 6, 2017
@VadimDez VadimDez self-assigned this Nov 7, 2017
@VadimDez VadimDez added the bug label Nov 7, 2017
@VadimDez VadimDez added this to the 3.0.0 milestone Nov 7, 2017
VadimDez added a commit that referenced this issue Nov 7, 2017
VadimDez added a commit that referenced this issue Nov 7, 2017
#196 Export module instead of component
@rsheptolut
Copy link
Author

That was fast! Thanks @VadimDez, it works now in 3.0.0!
BTW if anyone else stumbles upon this and has a problem like mine, you now need to import PdfViewerModule (not the PdfViewerComponent) and add it to the imports array of your Angular module.

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

No branches or pull requests

2 participants