Search code examples
javascriptgruntjsjspdfuglifyjsgrunt-contrib-uglify

Error with jspdf when using grunt uglify


I have a AngularJS application, in which i use jspdf library. When i run dev version with grunt serve, everything is fine. But if i build the app using grunt build, using uglify, the minified version has this errors:

jsPDF PubSub Error Cannot read property 'annotations' of undefined TypeError: Cannot read property 'annotations' of undefined
jsPDF PubSub Error Cannot set property 'pdf' of undefined TypeError: Cannot set property 'pdf' of undefined

"grunt-contrib-uglify": "0.11.1"

I found the corresponding GitHub issue, but it doesn't help.


Solution

  • I updated grunt-contrib-uglify and grunt-usemin and it solved the problem for me.