未捕获的ReferenceError:模块未定义Angular 6

时间:2018-09-23 22:02:50

标签: angular typescript

我正在尝试导入位于此处的外部js库-https://github.com/bcabanes/angular-image-cropper/blob/master/src/imageCropper.js

我在我的angular项目中本地下载了此js文件,并在angular.json文件中将了该js文件包含在脚本中。

我正在尝试通过该库将导出的模块导入我的directive.ts文件。但是当我在浏览器中渲染它时,以某种方式在我的directive.ts文件中引用它之后,它在控制台-_

中给我错误
Uncaught ReferenceError: module is not defined at imageCropper.js:1

imageCropper.js中的第一行是- module.exports = Cropper;

这是我的directive.ts文件中的代码

import { Directive, Input, ElementRef, OnInit, HostBinding} from '@angular/core';

declare var Cropper: any; <= This line throws error in browser console
@Directive({
  selector: 'img[processpic]',
})
export class ImageCropperDirective implements OnInit{  
   //some property and method binders
   ngOnInit(){
     //some directive init code
   }
}

感谢任何帮助。

0 个答案:

没有答案
相关问题