ng2-dragula 使用报错 Uncaught ReferenceError: global is not defined

Angular2使用ng2-dragula实现拖拽功能报错 

ncaught ReferenceError: global is not defined
    at Object../node_modules/crossvent/node_modules/custom-event/index.js (vendor.js:88511)
    at __webpack_require__ (runtime.js:79)
    at Object../node_modules/crossvent/src/crossvent.js (vendor.js:88572)
    at __webpack_require__ (runtime.js:79)
    at Object../node_modules/dragula/dragula.js (vendor.js:88756)
    at __webpack_require__ (runtime.js:79)
    at Module../node_modules/ng2-dragula/dist/fesm5/ng2-dragula.js (vendor.js:102351)
    at __webpack_require__ (runtime.js:79)
    at Module../src/app/app.module.ts (main.js:273)
    at __webpack_require__ (runtime.js:79)

 

解决办法

在polyfills.ts 加入 

(window as any)['global'] = window;

 

ng2-dragula 使用报错 Uncaught ReferenceError: global is not defined_第1张图片

你可能感兴趣的:(Angualr2)