Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Missing EventEmitter on recent RCs of @angular/cli #99

Closed
kamilkisiela opened this issue Mar 20, 2017 · 7 comments
Closed

Missing EventEmitter on recent RCs of @angular/cli #99

kamilkisiela opened this issue Mar 20, 2017 · 7 comments

Comments

@kamilkisiela
Copy link
Contributor

An error:

eventemitter3_1.EventEmitter is not a constructor

It happens inside a project that has been created by @angular/cli@^1.0.0-rc.1.


In client.ts, we've got this:

import { EventEmitter } from 'eventemitter3';

In eventemitter3/index.js:

EventEmitter.EventEmitter = EventEmitter;
export default EventEmitter;

Webpack creates a bundle file that contains that:

var _eventemitter3 = require('eventemitter3');

// inside SubscriptionClient of `subscriptions-transport-ws`

this.eventEmitter = new _eventemitter3.EventEmitter();

The thing is, _eventemitter3 has no EventEmitter property assigned. It's missing...

console.log(_eventemitter3); // EventEmitter class
console.log(_eventemitter3.EventEmitter); // undefined

When you look up for the eventemitter3 package inside the bundle file, there's no EventEmitter.EventEmitter but there's another property available that has been assigned the same way (EventEmitter.prefixed). It somehow removes the assignment from the code.

Weird...

@kamilkisiela
Copy link
Contributor Author

Continuing apollographql/GitHunt-Angular#100

@jmarlow4
Copy link

Any progress on this?

@jhartma
Copy link

jhartma commented Apr 18, 2017

having the exact same issue

@tobiaghiraldini
Copy link

tobiaghiraldini commented Apr 19, 2017

Same issue also here. even with subscriptions-trasport-ws@0.5.5. I also tried to upgrade the eventemitter3 dependency with no luck.
this issue is preventing to setup a ws communication with opengraph servers. Is there any workaround at least?
And I'm using angular cli 1.0.0 stable, not RC

@nakedcity
Copy link

nakedcity commented Apr 20, 2017

check: npm ls eventemiter3
packages are using the eventemiter3 e.g karma uses 1.x
solution: npm i eventemitter3@2.0.3 --save

@jhartma
Copy link

jhartma commented Apr 20, 2017

thanks, that works

@Urigo
Copy link
Contributor

Urigo commented May 19, 2017

Fixed in 0.6.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants