[ANGULAR] Zone.js Runtime error on Firefox

Our state of the art Gantt chart


User avatar
cedric.lamalle
Posts: 6
Joined: Fri Jun 05, 2020 11:35 pm

[ANGULAR] Zone.js Runtime error on Firefox

Post by cedric.lamalle »

Hello,
We are having the following error with our Code when loaded in the Firefox browser:

Code: Select all

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?

Regards,
Cédric.

Edit:
Versions:
Angular 5.2.11
bryntum-gantt 2.1.4
Firefox 81.0 (64-bits)


User avatar
saki
Core Developer
Core Developer
Posts: 811
Joined: Thu Mar 30, 2017 9:32 am

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by saki »

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.js after our umd bundle, it will work.

For that:

  1. comment line that imports zone.js in src/polyfills.ts

    Code: Select all

    // import 'zone.js/dist/zone';  // Included with Angular CLI.
  2. add import to src/main.ts as the last import:

    Code: Select all

    // 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.

User avatar
cedric.lamalle
Posts: 6
Joined: Fri Jun 05, 2020 11:35 pm

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by cedric.lamalle »

Hello,
Thanks for the answer, I will try this.

Thanks,
Cédric.


User avatar
fabio.policeno
Core Developer
Core Developer
Posts: 167
Joined: Sun Jul 12, 2020 8:22 pm

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by fabio.policeno »

Great Cedric, please keep us updated if it works. Thank's!

Fabio Jr. Policeno
Core Developer


User avatar
cedric.lamalle
Posts: 6
Joined: Fri Jun 05, 2020 11:35 pm

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post 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.


User avatar
saki
Core Developer
Core Developer
Posts: 811
Joined: Thu Mar 30, 2017 9:32 am

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post 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.


User avatar
saki
Core Developer
Core Developer
Posts: 811
Joined: Thu Mar 30, 2017 9:32 am

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post 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.


User avatar
saki
Core Developer
Core Developer
Posts: 811
Joined: Thu Mar 30, 2017 9:32 am

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by saki »

One more thing to try:

Code: Select all

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.


User avatar
cedric.lamalle
Posts: 6
Joined: Fri Jun 05, 2020 11:35 pm

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by cedric.lamalle »

Hello Saki,
I will try it on monday.

Thanks for the answer!
Cédric.


User avatar
saki
Core Developer
Core Developer
Posts: 811
Joined: Thu Mar 30, 2017 9:32 am

Re: [ANGULAR] Zone.js Runtime error on Firefox

Post by saki »

Thank you Cédric. Let us know the result then.


Post Reply