eventsource
eventsource copied to clipboard
Angular Event source is not a constructor error
Hi Team,
I am using this package in angular and find my environmental details below,

I am using this package to achieve the SSE in client-side
import { EventSource } from 'eventsource';
const eventSourceUrl = 'http://localhost:3000/v1/notifications';
const eventSourceInitDict = { headers: { Authorization: 'Tokken' } };
const noticationEventSource = new EventSource(eventSourceUrl, eventSourceInitDict);
And I am facing the error like below
ERROR TypeError: eventsource__WEBPACK_IMPORTED_MODULE_9__.EventSource is not a constructor
it is fixed by modifying the import statement as below
import EventSource from 'eventsource';
But facing another issue like not an function #236