Angular build fails when using html2canvas with await/async
See original GitHub issuePlease make sure you are testing with the latest release of html2canvas. Old versions are not supported and issues reported for them will be closed.
Please follow the general troubleshooting steps first:
- You are using the latest version
Bug reports:
When I run ng build
to an Angular 7 application that uses html2canvas
as:
const canvas = await html2canvas(el as HTMLElement, { useCORS: true });
I get the following error:
error TS2349: Cannot invoke an expression whose type lacks a call signature. Type ‘typeof import(“C:/my-app/node_modules/html2canvas/dist/types/index”)’ has no compatible call signatures.
Specifications:
- html2canvas version tested with: 1.0.0-rc.2 - 1.0.0-rc.7
- Browser & version:
- Operating system: Windows 10
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:15
Top Results From Across the Web
Angular using html2canvas and waiting until its completed ...
Yes, you can use async/await . This is how you change your code: part1() { const element = document.getElementById("capture") as ...
Read more >html2canvas@1.0.0-rc.2 makes Angular project build failed ...
In the end, it failed. I guess it because of html2canvas@1.0.0-rc.2,maybe . Summary log: Node#moveTo was deprecated. Use Container#append.
Read more >Html2Canvas With Angular Not Working As Intended - ADocLib
Old versions are not supported and issues reported for them will be closed. Please follow the Angular build fails when using html2canvas with...
Read more >html2canvas - Bountysource
I'm using webkit brightness effect on canvas but while converting that canvas into new canvas these effects are not applied.. -webkit-filter: brightness(1.3); - ......
Read more >use await in angular Code Example
private async fetchData(){ const data = await this.httpClient.get(this.apiUrl).toPromise(); console.log("Data: " + JSON.stringify(data)); }
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For those of us new to angular, if you’re on Angular 8 this means changing package.json
"html2canvas": "1.0.0-rc.1"
and then runningnpm i --verbose
@AdditionAddict RC1 helped me to build successfully. Thanks.