Uncaught ReferenceError: global is not defined on Agular ^8
aloksharma1 opened this issue · 3 comments
- My issue title starts with
[bug report]
- I have read the README, especially the 'classic blunders' section, and the dragula docs.
- I have searched through the
ng2-dragula
issues for related problems, including closed issues. - I have browsed through the issues labeled "future reference" for problems that have been solved before or have a known workaround.
- I am using the latest version of
ng2-dragula
.
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:
- Go to 'your angular demo project with latest cli & angular version ^8
- add dragula & ng2-dragula to your project
- ng serve or npm run start
- 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
Have you added this in your polyfills btw? https://github.com/valor-software/ng2-dragula#1-important-add-the-following-line-to-your-polyfillsts
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 -->
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.