如何将node-pnglib导入Angular 2 + / Typescript项目?

时间:2018-10-26 16:16:38

标签: angular typescript libpng

我正在尝试在Angular 6项目中使用node-pnglib生成PNG。

import * as PNGlib from 'node-pnglib';

但是,出现以下错误:

Uncaught TypeError: Cannot read property 'split' of undefined
at Object../node_modules/node-pnglib/lib/buf.js (buf.js:4)
at __webpack_require__ (bootstrap:83)
at Object../node_modules/node-pnglib/lib/pnglib.js (pnglib.js:5)
at __webpack_require__ (bootstrap:83)
at Module../src/app/default-image.service.ts (date.service.ts:6)
at __webpack_require__ (bootstrap:83)
at Module../src/app/article.service.ts (article-user.service.ts:12)
at __webpack_require__ (bootstrap:83)
at Module../src/app/app.module.ts (app.component.ts:16)
at __webpack_require__ (bootstrap:83)

这是库中的相关行:

var MAJOR = typeof process !== 'undefined' ? process.version.split('.')[0].slice(1) : 0;

0 个答案:

没有答案