I am facing challenges with the implementation of NgZones. Despite defining NgZone, I keep encountering this error: "NodeInvocationException: Prerendering failed because of error: ReferenceError: NgZone is not defined"
Below is my app.error-handle.ts file where I utilize NgZone:
import { ToastyService } from 'ng2-toasty';
import { ErrorHandler, Inject, NgZone } from '@angular/core';
export class AppErrorHandler implements ErrorHandler {
constructor(
private ngZone: NgZone,
@Inject(ToastyService) private toastyService: ToastyService) {
}
handleError(error: any): void {
this.ngZone.run(() => {
this.toastyService.error({
title: 'Error',
msg: 'An unexpected error happened.',
theme: 'bootstrap',
showClose: true,
timeout: 5000
});
});
}
}
This is an excerpt from my webpack.config.vendor.js file:
const path = require('path');
// Rest of webpack configuration code...