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.

Compilation error Angular 7 and 8 in AoT

See original GitHub issue
  • I have read the README and API docs (if applicable); the issue is not covered there.
  • I have searched the repository issues and pull requests; my query is not covered there.

  • Expected behaviour: build success
  • Actual behaviour: build failed
  • Environment:
    • Node version: 8.12.0
    • Browser and browser version (if applicable): Chrome
  • Steps to reproduce:
npm i
npm run build

ERROR in Error during template compile of ‘AppModule’ Function calls are not supported in decorators but ‘NgForageModule’ was called.

Additional information, screenshots etc go here.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

weronikasabiniewiczcommented, Jan 10, 2019

Hi everyone!

I have a problem with AOT compilation in Angular 7.1. I have tried config ngForage in both of presenting ways. The first was into it in AppModule constructor, and second one as a provider (with DEFULT_CONFIG). Unfortunately, when I use ngForage:

ngOnInit(){ this.forage.storeName = 'MyStorage; this.forage.setItem('key','value'); }

forage is NgForage as Dependency Injection in the constructor.

During the building isn’t any errors. Then, after load the website, I have a one error in the console:


This happened only if I have built it with aot option.

Do you know what I am doing wrong? Or is there any workaround?

Alorelcommented, Oct 30, 2018

Yeah, I’ve gotten this bug too but I have no idea why after hours of debugging and trying out various solutions by people with similar issues. At the moment it appears to be a regression from Angular 6 as the module hasn’t changed (4.0.0 | 3.4.0).

If you have any solutions do let me know please!

You can get around it for now, though. NgForage consists only of services, so importing the module isn’t actually necessary; you can simply perform the default configuration in your AppModule’s constructor:

import {BrowserModule} from '@angular/core';
import {NgForageConfig} from 'ngforage';

@NgModule({imports: [BrowserModule]})
export class AppModule {
  public constructor(ngfConfig: NgForageConfig) {

Issue reported here:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ahead-of-time (AOT) compilation - Angular
The AOT compiler detects and reports template binding errors during the build step before users can see them. Better security, AOT compiles HTML...
Read more >
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 >
What is AOT and JIT Compiler in Angular ? - GeeksforGeeks
You can catch template binding error at display time. You can catch the template error at building your application. Conclusion: You can compile...
Read more >
Meteor 1.10.1 breaks Angular integration when AOT is enabled
Building with AOT enabled breaks with these errors: with Angular 7/8 I get: compiler.ts:843:42: host.isSourceFile is not a function ...
Read more >
Angular 6 vs Angular 7 vs Angular 8 vs Angular 9
Angular 7 added a new compiler called the Angular Compatibility Compiler (ngcc). Just like the name suggests, the angular compiler offers an 8- ......
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 Post

No results found

github_iconTop Related Hashnode Post

No results found