-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
How to use jsPDF in node? Gets _jspdf2.default is not a constructor error #783
Comments
try in index.html => https://cdnjs.com/libraries/jspdf |
@THPubs I think you'll need to do one of these:
or
This is because es6 import syntax is subtly different than node's import syntax. Probably you're best off using node require, unless this lib is updated to better accommodate es6. I'm not 100% sure how it all works. there's more discussion at, for example, microsoft/TypeScript#5565 |
I was facing the same problem, but was
I removed the brackets and now it is working. I'm using SystemJS to load, so I mapped it in my config.js installed typings: And in my component.ts
|
How did you guys get around the |
it works for REACT!
|
I guess it works now. |
I got it working with this syntax:
and since it is a good practice for any constructor to start with a capital letter and most likely linter would catch it as an error if you used a small letter, this syntax can be used:
|
I am getting the same error:
|
@RSPaul did you |
@HackbrettXXX Yes, I used it but still getting the same error. |
@RSPaul well then we need more information. Please share your complete code snippet, any build tools you use, node version, jsPDF version, etc. |
I get this error
due to doc.html() in below code
|
The |
I tried to import jspdf like this in my node app :
Then tried to use the example code :
Then I get an error saying
_jspdf2.default is not a constructor error
. What is the right way to do this?The text was updated successfully, but these errors were encountered: