The bug occures only when using SSR because of the line in customElements.define('notification-center-web-component', NotificationCenterWebComponent);
SSR does not know a "window"-Instance and thus also does not know customElements. A solution would be to check whether it's an SSR and only register then. It seems also to be only related with Angular 17 apps, it worked in earlier versions where there was not Vite and esbuild in use.
It would be nice that it would work with SSR and Angular 17.
👎 Actual Behavior with Screenshots
Error:
customElements is not defined
at eval (/Users/sihu/demo4/node_modules/@novu/notification-center-angular/dist/fesm2022/novu-notification-center-angular.mjs:4:1)
at async instantiateModule (file:///Users/sihu/demo4/node_modules/vite/dist/node/chunks/
Novu version
@novu/notification-center-angular "^0.23.1"
npm version
10.4.0
node version
v20.11.0
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
📜 Description
The bug occures only when using SSR because of the line in
customElements.define('notification-center-web-component', NotificationCenterWebComponent);
SSR does not know a "window"-Instance and thus also does not know
customElements
. A solution would be to check whether it's an SSR and only register then. It seems also to be only related with Angular 17 apps, it worked in earlier versions where there was not Vite and esbuild in use.👟 Reproduction steps
👍 Expected behavior
It would be nice that it would work with SSR and Angular 17.
👎 Actual Behavior with Screenshots
Error:
Novu version
@novu/notification-center-angular "^0.23.1"
npm version
10.4.0
node version
v20.11.0
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Contributing Guidelines?
Are you willing to submit PR?
None