valor-software/ng2-dragula

Uncaught ReferenceError: global is not defined on Agular ^8

aloksharma1 opened this issue · 3 comments

Describe the bug (required)

When using Angular 8, just add ng2-dragula as you normally would and everything works fine till compile but on browser console, i am getting the following error:

Uncaught ReferenceError: global is not defined
    at Object../node_modules/crossvent/node_modules/custom-event/index.js (index.js:2)
    at __webpack_require__ (bootstrap:79)
    at Object../node_modules/crossvent/src/crossvent.js (crossvent.js:3)
    at __webpack_require__ (bootstrap:79)
    at Object../node_modules/dragula/dragula.js (dragula.js:4)
    at __webpack_require__ (bootstrap:79)
    at Module../node_modules/ng2-dragula/dist/fesm2015/ng2-dragula.js (ng2-dragula.js:1)
    at __webpack_require__ (bootstrap:79)
    at Module../src/app/app.module.ts (app.component.ts:9)
    at __webpack_require__ (bootstrap:79)

To Reproduce (required)

Steps to reproduce the behavior:

  1. Go to 'your angular demo project with latest cli & angular version ^8
  2. add dragula & ng2-dragula to your project
  3. ng serve or npm run start
  4. See error in browser console, project won't run

is this due to ng2-dragula behind the current cli , is there any way i can use it with angular v8 since my project is already most done with newer version.
possibly related to #849 but that thread is talking about angular cli 6 while i am using 8, please suggest the best.

thanks

Hi George, we migrated from Angular 7 to 8 and same error. We already implemented these changes on Angular 7 and it was working. But in Angular 8, with same configuration, it does not work.

And if we use the solution here -->

https://stackoverflow.com/questions/50356408/upgrading-to-angular-6-x-gives-uncaught-referenceerror-global-is-not-defined

We are getting the following message

Error: Zone.js has detected that ZoneAwarePromise (window|global).Promise has been overwritten. Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.) at Function.assertZonePatched (zone-evergreen.js:52) at new NgZone (core.js:39457) at getNgZone (core.js:40708) at PlatformRef.bootstrapModuleFactory (core.js:40523) at core.js:40604 at exceljs.min.js:3

This article explains the issue quite well. The link is straight to the problem mentioned by this issue but the entire article can be read as a good to know thing.

https://www.amadousall.com/angular-cli-module-not-found-error-cant-resolve/#related-issue-uncaught-referenceerror-global-is-not-defined