Hello,
We are having the following error with our Code when loaded in the Firefox browser:
Error: Zone.js has detected that ZoneAwarePromise (window | global) .Promise has been overwritten.
We made the change suggested in the topic: viewtopic.php?p=69856#p69856. The suggested change solves the problem in development mode, but the same error occurs if you build the application in production mode.
Do you have any other suggestions for trying to solve the problem?
We are working on a permanent solution of this problem but there is a workaround you can use immediately.
This happens because we define Promise as a polyfill to increase the browser compatibility. Therefore, if gantt.umd.js is loaded after zone.js then Promise is redefined, this situation is detected and the error is thrown. Therefore, if we load zone.jsafter our umd bundle, it will work.
For that:
comment line that imports zone.js in src/polyfills.ts
// import 'zone.js/dist/zone'; // Included with Angular CLI.
add import to src/main.ts as the last import:
// Moved from polyfills.ts to main.ts for proper support of UMD bundle which contains polyfills.
import 'zone.js/dist/zone'; // Included with Angular CLI.
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Fri Sep 25, 2020 6:19 pm
by cedric.lamalle
Hello,
Thanks for the answer, I will try this.
Thanks,
Cédric.
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Fri Sep 25, 2020 7:18 pm
by fabio.mazza
Great Cedric, please keep us updated if it works. Thank's!
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Fri Sep 25, 2020 7:52 pm
by cedric.lamalle
Hello,
While testing it, I realized that it was exactly the same workaround than of viewtopic.php?p=69856#p69856
So this is working in development mode, but not after the code has been built in production mode it doesn't work anymore.
Regards,
Cédric.
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Sat Sep 26, 2020 11:57 am
by saki
Hello Cédric,
we use the same approach for Scheduler and it works there in Angular 5 so there must be some difference either between Scheduler and Gantt or between our demo and your app. Could you please post a minimal showcase that demonstrates the problem?
Then we can run it locally, debug and fix the problem.
Thank you.
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Sat Sep 26, 2020 7:32 pm
by saki
Hello Cédric,
I have tested the issue and indeed it works in development mode but when the application is compiled with --prod switch then it doesn't work in Firefox or Safari. So no need to prepare a showcase on your end; we can reproduce the issue.
We will address it on priority early next week when we will provide a solution.
Re: [ANGULAR] Zone.js Runtime error on Firefox
Posted: Sat Sep 26, 2020 8:00 pm
by saki
One more thing to try:
npm i zone.js@latest
in you project root. Version 0.11.1 works for me so far w/o negative consequences. Try it please and let us know if it worked.