Angular6 - ng build / serve --prod - Error during template compile of 'AppModule'
See original GitHub issueI have this problem when I’m building or seving an Angular6 application for PROD with ng serve --prod
or ng build --prod
ERROR in app/app.module.ts(84,47): Error during template compile of 'AppModule'
Complex function calls are not supported. in 'intersectionObserverPreset'
'intersectionObserverPreset' references 'intersectionObserverPreset'
'intersectionObserverPreset' references 'intersectionObserverPreset'
'intersectionObserverPreset' contains the error.
This is what I have in the line app/app.module.ts(84,47)
import { LazyLoadImageModule, intersectionObserverPreset } from 'ng-lazyload-image';
@NgModule({
imports: [
...,
/*84 -->*/ LazyLoadImageModule.forRoot({ preset: intersectionObserverPreset }) /*<-- 84*/
],
declarations: [...],
entryComponents [...],
providers: [...],
bootstrap: [...]
})
Versions:
angular: 6.1.0
ng-lazyload-image: 5.0.0
npm: 5.6.0
node: 8.11.4
typescript: 2.7.2
It seems to have something to do with AOT but I can’t find a way to fix it. This error does not occur when normally running the commands ng build
or ng serve
I appreciate any help
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (7 by maintainers)
Top Results From Across the Web
ERROR in Error during template compile of 'AppModule'
Trying to build an Angular 6 app. I am getting the following error when using --prod. ERROR in Error during template compile of...
Read more >ERROR in Error during template compile of 'AppModule'
I had the same error when attempting to use a UrlMatcher when AOT was enabled for the production build. const adminRoutes: Routes =...
Read more >Ahead-of-time (AOT) compilation - Angular
When you run the ng build (build only) or ng serve (build and serve locally) CLI commands, the type of compilation (JIT or...
Read more >Leveling up our developer experience | Accelerating Angular ...
Compile -time errors are a positive side effect of Angular using an AOT compiler. However, some of the build errors have needed additional...
Read more >Angular App Shell - Boost Application Startup Performance
And this will create a new folder named my-app-shell with a new ... ng serve --prod ... What does the ng generate app-shell...
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
I have the exactly same issue, and I am using angular version 7. It wokrs on ‘ng serve’ but not ‘ng build --prod --aot’
is there any solution for the issue?
Updating to ng-lazyload-image@5.1.2 and angular 7 solved the issue. Thanks for resolving .