Hey there,
I've tried to import jsPDF into my Ember App but sadly without any success :/
Are you using the latest version of jsPDF?
"version": "1.3.2"
Steps to reproduce
I have importet jspdf.debug.js like described at https://guides.emberjs.com/v2.0.0/addons-and-dependencies/managing-dependencies/#toc_globals-provided-by-javascript-assets
app.import('bower_components/jspdf/dist/jspdf.debug.js');
What I saw
Uncaught Error: an unsupported module was defined, expected define(name, deps, module) instead got: 1 arguments to define
I've tried to extend the define() call in jspdf.debug.js but it seems that I'm doing it at the wrong place...
`
jsPDF.API = { events: [] };
jsPDF.version = "1.3.2 2016-09-30T20:33:17.116Z:jameshall";
if (typeof define === 'function' && define.amd) {
// INFO: I've added [] to the call down here
define('jsPDF', [], function () {
return jsPDF;
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = jsPDF;
} else {
global.jsPDF = jsPDF;
}
return jsPDF;
`
Any help would be highly appreciated.
Cheers,
Michael
I'm getting the same error. Had to revert back to 1.2.61
Strange, we changed to rollup since the 1.2.x releases. It's got something to do with that. Will take a look.
I seem to be getting the same issue with v1.3.2 has there been any solutions to getting this to work?
Same issue here v1.3.2
I found the problem, however it is in a third party dependency:
File: node_modules/adler32cs/adler32cs.js

define(callback) should be define([], callback)

This repo https://github.com/chick307/adler32cs.js hasn't had any contribution for 4 years though....
Should it not then be forked and link in jsPDF package.json file pointed to the fork?
Just wandering about the best approach to getting it to work.
If you are using Ember (loader.js) and want the version 1.3.5 of jspdf here is the minified version of my pull request #1514
Most helpful comment
I found the problem, however it is in a third party dependency:
File: node_modules/adler32cs/adler32cs.js
define(callback) should be define([], callback)
This repo https://github.com/chick307/adler32cs.js hasn't had any contribution for 4 years though....