-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Zone.js has detected that ZoneAwarePromise (window|global).Promise
has been overwritten
#1008
Comments
Duplicate of #984 |
I am able to make it work in local by removing zone.js imports from polyfills.ts file and adding them to main.ts at the end. But, having same ZoneAwarePromise issue again after build and publish. Any updates ? |
No solutions worked for me i saw some old libraries with this issue, i could not see exactly what they changed to fix it ( 2017-18) |
Made it work for the normal build (ng build), but for PROD Build - no luck yet. |
fixed mine by importing it before 'core-js' and 'zone.js' in the pollyfills.ts file pollyfills.ts file:
|
I do not include 'core-js', but your comment made me realise something, the conflict is with and this particular solution is provided here: angular/zone.js#783 (comment) In order for this to work anyone who is loading excelJs in the component/service should remove the imports and only So the final code will be : import {Row, Workbook, Worksheet} from 'exceljs';
...
const workbook: Workbook = new Workbook();
const sheet: Worksheet = workbook.addWorksheet( .... Extra: |
I could not pinpoint what is calling core-js or es5-polyfills , but something is. According to this we should add it manually but something is definitely still adding a polyfill for Promise
|
Oh so the polyfill for Promise is actually embedded in the code. |
@bleuscyther , I am still having zoneawarepromise error even after I import exceljs into polyfills. Any idea? |
This one when tried, only version 2.0.1 is working. Right now the 3.0 version is running, any plan that will fix for this issues? |
I have tried different versions. It's working on 2.0.1 and for higher versions, you may need to add zone.js imports in main.ts instead of polyfills file but that's not a good idea and may cause issues during builds. For Esceljs- 2.0.1 import * as ExcelJS from 'exceljs/dist/exceljs.min.js'; It's working on both DEV and PROD builds without any issues. |
uhh no (at-least for me)?? i'm using the latest version 3.3.1 and i only need to import it before the zone.js at the pollyfills.ts file, then that's it:
my angular version is 7.2.3 |
I suggested a PR that should fix this issue. You can download it and build to test the excelis.min files. It worked for me i did not need to import in the polyfill.ts anymore. import {Row, Workbook, Worksheet} from 'exceljs';
...
const workbook: Workbook = new Workbook();
const sheet: Worksheet = workbook.addWorksheet( .... |
@bleuscyther I am using exceljs version from your branch. This leads to another issue: I did not add exceljs import in polyfill.ts. Did you face that problem? |
@lukaszreszke93, which version of Excel JS are you using? |
@nvkolluru I am using version from @bleuscyther's branch |
@lukaszreszke93 you have to build it first an then use the .j s files from the dist folder. |
There is error when exceljs is used in code.
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.)"
Angular 5
o exceljs.min.js:3
My service.ts file
import { Injectable } from '@angular/core';
import * as Excel from "exceljs/dist/exceljs.min.js";
import * as fs from 'file-saver';
@Injectable({
providedIn: 'root'
})
export class ExcelserviceService {
constructor() { }
generatereport(dummydata):void{
let worksheet = workbook.addWorksheet('Car Data');
}
}
The text was updated successfully, but these errors were encountered: