jsPDF loading issue with EmberJS

Created on 12 Oct 2016  路  8Comments  路  Source: MrRio/jsPDF

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

Most helpful comment

I found the problem, however it is in a third party dependency:

File: node_modules/adler32cs/adler32cs.js

image

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

image

This repo https://github.com/chick307/adler32cs.js hasn't had any contribution for 4 years though....

All 8 comments

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

image

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

image

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

https://gist.githubusercontent.com/dusanstanojeviccs/e72bcb0221cc71afd79f17cc0d2909ec/raw/321445afbac6e2ef3811a3ee07f6ec09af4ad0aa/jspdf.min.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mackersD picture mackersD  路  4Comments

BarathArivazhagan picture BarathArivazhagan  路  4Comments

andmaltes picture andmaltes  路  4Comments

sayo96 picture sayo96  路  3Comments

arulmb0136 picture arulmb0136  路  4Comments