I am working on developing an Angular application with SSR (using Angular Universal) and when launching the application on the remote server I get this error:
Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
However, if I launch the application on the local server, everything works correctly.
I have investigated where we load the zone.js and we are loading it in the main.server.ts file (for the server application)
import '@angular/platform-server/init';
/** *************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
import 'zone.js/dist/zone-node';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
and in the polyfills.t (for the Browser application).
import '@angular/localize/init';
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
(window as any).process = { env: { DEBUG: undefined }, };
I have read numerous posts where it is pointed out that there may be something overwriting it, but we don't know what it could be.
Can anyone give me some suggestions on where to look?
Thanks