Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Event source is not a constructor error #235

Closed
udhayakumarcp opened this issue Jan 4, 2022 · 2 comments
Closed

Angular Event source is not a constructor error #235

udhayakumarcp opened this issue Jan 4, 2022 · 2 comments

Comments

@udhayakumarcp
Copy link

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
Copy link
Author

udhayakumarcp commented Jan 4, 2022

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

But facing another issue like not an function #236

@rexxars
Copy link
Member

rexxars commented Dec 7, 2024

Fixed in eventsource@^3.

@rexxars rexxars closed this as completed Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants