Skip to content
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

Error: Mismatched anonymous define() module #1073

Closed
Messmania opened this issue Mar 3, 2017 · 19 comments
Closed

Error: Mismatched anonymous define() module #1073

Messmania opened this issue Mar 3, 2017 · 19 comments
Labels

Comments

@Messmania
Copy link

This issue was resolved in March 2014 (Issue #122 ) but it resurfaced after a commit in 2016.
As per my understanding require.js doesn't load libraries with multiple defines properly and hence the error.
I tried going back to older version of jspdf but latest autoTable version fails with that.
I am using jspdf 1.3.2 and autotable 2.1.0
Can you please fix this?

@ysneo
Copy link

ysneo commented Mar 31, 2017

the same to you ,the problem recurred in my project

@sblantipodi
Copy link

Same here

@Marnnn
Copy link

Marnnn commented Feb 21, 2018

I'm getting this error when using jsPDF with RequireJS, the error in the console actually points to part of the jspdf.min.js file that has a minified script of html2canvas 0.5.0-beta3 included. This version isn't AMD compliant, from looking at html2canvas it wasn't working with RequireJS until version 1.0.0-alpha10. I know you have an issue about modularising the dependencies #839 which I'm sure this fits under but do you think this is what's causing the mismatch error? Anyway we can update jsPDF to use the latest version of html2canvas?

Here is a screenshot of VSC, I've copied and pasted the script from the Error in the console and found it in the jspdf.min.js file.

image

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 21, 2018

The problem is, that I could simply change the define calls so that they are not anonymous anymore. But because I don't use your environments I can't check if it is working properly with my solution.

If I supply you an modified jsPDF.debug.js, would/could you test if it is working?

@Marnnn
Copy link

Marnnn commented Feb 21, 2018

Sure I understand, I am also using this within a Qlik Sense extension so it's not a normal environment, I just supply the require definitions and they're dealt with by a higher power.

Happy to test with a modified debug file, just let me know what you need me to do.

@Marnnn
Copy link

Marnnn commented Feb 21, 2018

I just required the current debug file I have and again the part of the code in the Error console seems to be related to the html2canvas 0.5.0-beta3 section.

There's two errors actually, there and another one by the chick307 _hasarraybuffer part.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 21, 2018

  1. Current Version in dist folder is jsPDF 1.3.5, it doesnt contain all new features and bugfixes. But that is independent from the question if we can fix the define-calls. If the define calls are fixed then I think we can put the fixes so that we have it in the next release.

Do you have the issue number of the hasarraybuffer bug?

@Uzlopak Uzlopak closed this as completed Feb 21, 2018
@Uzlopak Uzlopak reopened this Feb 21, 2018
@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 21, 2018

Accidently closed. Sry

@Marnnn
Copy link

Marnnn commented Feb 21, 2018

I'm using v1.3.5 and agree with you there.

It's not an issue on here. I was referring to getting two console errors when requiring the 1.3.5 jspdf.debug.js file. One error points to the code related to html2canvas 0.5.0-beta3 which I think should be updated to the latest version. The other error message points to the part of the file that has the adler32cs code that does the _hasarraybuffer stuff.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 22, 2018

Removed anonymous define calls with PR #1646

@Marnnn
Copy link

Marnnn commented Feb 23, 2018

Amazing, thank you arasabbasi this has worked a treat. No more console errors and it seems to be quicker performing the screenshot which is a bonus.

Weirdly it works on my local machine really well but on our dev server some of the image seems to loose the css (this happened before this PR). I'm going to investigate this as I'm sure it's something our side but thought I'd mention it in case you had any ideas? Might be more to do with html2canvas I suspect.

Thanks for your help. Do you need anything from me?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 23, 2018

Well if you have bug reports, than supplying them would be neat. I talked with MrRio and we plan the new release for next week. So anything what can be fixed now...

@Uzlopak Uzlopak added the Fixed label Feb 23, 2018
@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 23, 2018

I close this issue, because it is "fixed". If you have separate bugs, please open a new issue.

@Uzlopak Uzlopak closed this as completed Feb 23, 2018
@Uzlopak Uzlopak reopened this Feb 24, 2018
@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 24, 2018

@Marnnn

current version of html2canvas is 1.0.0-alpha.10 . how do you use html2canvas?

@Marnnn
Copy link

Marnnn commented Feb 24, 2018

Correct. The version inside the previous jsPDF min file was 0.5.0-beta-3. They’ve made it AMD-compliant in the new one.

I use it to turn the html into a canvas element, I then convert that to an image with dataToUrl and then add the image to the pdf with jsPDF.

@sheetalkrishna
Copy link

Hi,

Can you please tell me when will this issue be fixed? and What's the work - around for now?

Cheers,
Sheetal

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 6, 2018

I will update addHTML to recent html2canvas for jsPDF 1.4.2

Anonymous calls seem to be not complained anymore.

@Uzlopak Uzlopak closed this as completed Jun 6, 2018
@jarstelfox
Copy link

Which commit fixed this? I've gone through the repo's history and can not find where this is fixed

@Uzlopak
Copy link
Collaborator

Uzlopak commented Aug 31, 2018

Well, I am not a robot :D. Working now a bunch of heavy duty ToDos.

@parallax parallax locked and limited conversation to collaborators Aug 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants