在我的Wijmo项目中,我在Angular 4上使用wijmo.xlsx和JSZip遇到了麻烦。wijmo.xlsx需要JSZip作为依赖项。
如下所示,当我在TypeScript文件中导入JSZip时,它显示了JSZip的错误。
import * as JSZip from 'jszip';我使用npm install jszip --save安装了JSZip,但它不起作用。
我这次安装了@types/jszip,错误消失了。但是当我尝试使用JSZip时,它显示了以下错误:
(index):55 (SystemJS) window.require is not a function
TypeError: window.require is not a function at Object.eval
(http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:13:871)
at eval (http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:14:4)
at eval (http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:15:3)
at eval (<anonymous>)
at Object.eval
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:13:694) at eval
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:14:4) at eval
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:15:3) at eval
(<anonymous>)安装JSZip并与Angular 4一起使用的正确步骤是什么?我们是否需要先安装@types/jszip再安装JSZip
发布于 2018-02-26 18:07:40
https://stackoverflow.com/questions/47553623
复制相似问题