使用 grunt uglify 时 jspdf 出错

Error with jspdf when using grunt uglify

我有一个 AngularJS 应用程序,我在其中使用了 jspdf 库。当我 运行 开发版本 grunt serve 时,一切都很好。但是如果我使用 grunt build 构建应用程序,使用 uglify,缩小版本有这个错误:

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"

我找到了对应的GitHub issue,但是没用

我更新了 grunt-contrib-uglifygrunt-usemin,它解决了我的问题。