Object not a function, on jspdf invocation

Viewed 1793

I have borrowed the code from here and I am trying to make it work as a proof of concept in my React application.One of the issues I encounter is with line:

var pdf = new jspdf('p', 'pt', 'letter');

In such case I get the following error: TypeError: WEBPACK_IMPORTED_MODULE_2_jspdf.jspdf is not a constructor

If I remove 'new' var pdf = jspdf('p', 'pt', 'letter');

I am getting the error: TypeError: Object(...) is not a function

What am I doing wrong. It seems like it is working in all examples, but no in my editor :)

1 Answers

It's a typo

const jsPDF = require('jspdf')
var pdf = new jsPDF('p', 'pt', 'letter')
Related