TypeError: html2canvas.default is not a function
See original GitHub issue- You are using the latest version
- You are testing using the non-minified version of html2canvas and checked any potential issues reported in the console
Bug reports:
Simple Call:
html2canvas(document.getElementById('passport-questions-form')).then(canvas => {
// code...
});
Is giving me:
ERROR TypeError: html2canvas_1.default is not a function
This happened after upgrading Angular cli@1.6.8 from 1.5.0. I assume it might be because there was a TypeScript Update?
- html2canvas version tested with: alpha.10
- Browser & version: chrome:64.0.3282.167
- Operating system: windows 10
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:21
Top Results From Across the Web
Angular: ERROR TypeError: html2canvas_1.default is not a ...
html file. I have a downloadPDF() function in app.component.ts. My goal is : when the .ts file is loaded, its constructor will ...
Read more >Angular 5 error: html2canvas_1.default is not a function #1561
I downloaded the latest version and lazy loaded the js file on my component which is showing when i go to inspect element->...
Read more >TypeError: $(...).html2canvas is not a function - Drupal
Hi, I found TypeError: $(...).html2canvas is not a function while using html2canvas function in my custom jquery.
Read more >A brand new website interface for an even better experience!
TypeError : html2canvas.default is not a function.
Read more >jspdf npm, html2canvas_1 default is not a function, jspdf ...
To render an element with html2canvas, simply call: html2canvas(element[, options]); The function returns ... typeerror t charcodeat is not a function jspdf.
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
Make sure to import the script under the scripts list in angular-cli.json “scripts”: [ “…/node_modules/html2canvas/dist/html2canvas.min.js” ]
And in the class as:
import * as html2canvas from “html2canvas”
For me the problem was I’m using TypeScript and the
node_modules\html2canvas\dist\types\index.d.ts
file is incorrect. It says that they are exporting html2canvas as the default exportexport default html2canvas;
. This is untrue.I had to use any to get around this as follows: