我正在使用Angular中的jsPDF从HTML生成PDF。它在我的本地计算机上运行良好,但是当我创建dist时,它会显示以下错误消息:
(function(t,e){var A,n=1,S=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},y=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},_=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return t.toFixed(2)},s=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return t.toFixed(5)};t.__acroform__={};var r=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},v=function(t){return t*n},w=function(t){return t/n},l=function(t){var e=new j,n=Y.internal.getHeight(t)||0,r=Y.internal.getWidth(t)||0;return e.BBox=[0,0,Number(_(r)),Number(_(n))],e},i=t.__acroform__.setBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|=1<<e},o=t.__acroform__.clearBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments pa
ReferenceError: window is not defined
at Object.<anonymous> (/var/www/html/html/youmakr/dist/server.js:451130:30237)
at module.exports (/var/www/html/html/youmakr/dist/server.js:451091:37)
at Object.<anonymous> (/var/www/html/html/youmakr/dist/server.js:451093:112)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:20:30)
at Object.jspdf (/var/www/html/html/youmakr/dist/server.js:432261:18)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
at Object../src/app/components/users/my-orders/my-orders.component.ts (/var/www/html/html/youmakr/dist/server.js:412409:13)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
at Object../src/app/components/users/my-orders/my-orders.component.ngfactory.js (/var/www/html/html/youmakr/dist/server.js:412343:10)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
at Object../src/app/app.server.module.ngfactory.js (/var/www/html/html/youmakr/dist/server.js:380520:11)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
at Object../src/main.server.ts (/var/www/html/html/youmakr/dist/server.js:432090:37)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
at Object.0 (/var/www/html/html/youmakr/dist/server.js:432106:18)
at __webpack_require__ (/var/www/html/html/youmakr/dist/server.js:378455:30)
答案 0 :(得分:0)
在创建dist之前。在生产模式下运行项目时,可能会出现一些错误,这限制了您的构建命令。