angular / universal

Server-side rendering and Prerendering for Angular
MIT License
4.04k stars 484 forks source link

Issue Regarding Gsap with anuglar universal #1857

Closed shreyas-1997 closed 2 years ago

shreyas-1997 commented 3 years ago

hello Sir! I have Developed a website in angular using gsap for the animations and much more and also it's work properly on CSR(Client Side Rendering).But i want to Rendered this app on SSR(Server Side Rendering) because of SEO purpose..for that i used angular universal .After using angular universal i am facing one issue i.e.. (intermediate value)(intermediate value).getBoundingClientRect is not a function. Here is the screenshot of the error image

I am getting this error only on SSR by using angular universal. Please guide or help me to fix this issue because i am working around since 2 weeks basically it is coming from gsap packages .if i removed that package then its works fine as expected but when reused that plugin than it's through the error (intermediate value)(intermediate value).getBoundingClientRect is not a function

Here is my project Repositary:-https://github.com/shreyas-1997/Angular-Development

Thank you so much! I hope i will get solution here asap..

moczix commented 3 years ago

getBoundingClientRect is DOM api, on SSR you cant access DOM. Try to use ifPlatformBrowser

shreyas-1997 commented 3 years ago

I used that but still not working see the line number 647 image

moczix commented 3 years ago

Im guessing your library, tweenMax is using some global state of window right in bundle. Try to load it dynamically in your if condition. You can also try to load it dynamically, this way ssr should not load this chunk on ssr

shreyas-1997 commented 3 years ago

Can you elaborate in more simple way

alan-agius4 commented 2 years ago

Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information.

If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.

angular-automatic-lock-bot[bot] commented 2 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.