Compilation error Angular 7 and 8 in AoT
See original GitHub issueIssue Description
- 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.
- Reproducible code sample:
Additional information, screenshots etc go here.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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?
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:
Issue reported here: https://github.com/angular/angular/issues/23609#issuecomment-433450395