eventsource icon indicating copy to clipboard operation
eventsource copied to clipboard

Angular Event source is not a constructor error

Open udhayakumarcp opened this issue 3 years ago • 1 comments

Hi Team,

I am using this package in angular and find my environmental details below,

image

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

udhayakumarcp avatar Jan 04 '22 05:01 udhayakumarcp

it is fixed by modifying the import statement as below import EventSource from 'eventsource';

But facing another issue like not an function #236

udhayakumarcp avatar Jan 04 '22 06:01 udhayakumarcp