Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

requirejs patch for anonymous define() #310

Merged
merged 1 commit into from

3 participants

@vuongdothanhhuy

This is the patch for my posted issue at: #309


I tried using jsPDF (.debug.js and .min.js) with RequireJS (2.1.11). Everything works fine until I use grunt to build my webapp. After minification, my webapp break with error:

screenshot

screenshot-1

I found a workaround to this problem, by specifying what is called a stringID for that define() function:

define('jsPDF', function(){
    return jsPDF;
});
@diegocr
Collaborator

Merging, and assuming this wouldn't cause a conflict for users using this approach.

Thanks!

@diegocr diegocr merged commit 8fb976e into MrRio:master
@metaman

This patch seems to have broken the ability to requirejs in the file. When I require in the latest version I get undefined however if I revert this change everything loads ok. Have you got any ideas? I know you are just naming the module so strange the impact it has had.

Hi @metaman,
Thank you for your feedback. I'm also quite surprise how could one very simple and legal change can result in undefined in the latest requirejs. I will look into it as soon as I have time. Meanwhile, it would be very welcome if anyone can come and help us! (especially those who master AMD/requirejs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 16, 2014
  1. @vuongdothanhhuy
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +1 −1  dist/jspdf.debug.js
  2. +1 −1  jspdf.js
View
2  dist/jspdf.debug.js
@@ -1700,7 +1700,7 @@ var jsPDF = (function(global) {
jsPDF.version = "1.0.178-debug 2014-06-27T15:34:diegocr";
if (typeof define === 'function' && define.amd) {
- define(function() {
+ define('jsPDF', function() {
return jsPDF;
});
} else {
View
2  jspdf.js
@@ -1700,7 +1700,7 @@ var jsPDF = (function(global) {
jsPDF.version = "1.0.0-trunk";
if (typeof define === 'function' && define.amd) {
- define(function() {
+ define('jsPDF', function() {
return jsPDF;
});
} else {
Something went wrong with that request. Please try again.