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

Server side rendering #407

Closed
khurram-wasim opened this issue May 8, 2018 · 8 comments
Closed

Server side rendering #407

khurram-wasim opened this issue May 8, 2018 · 8 comments

Comments

@khurram-wasim
Copy link

This is a feature request
Currently nebular does not support server side rendering
I followed this guideline:
https://github.com/angular/angular-cli/wiki/stories-universal-rendering
At the end I found out that nebular uses things which are not supported while rendering on the server side.
e.g. window, document, localstorage etc
Kindly fix this issue.

@denisobrienirl
Copy link

You might want to look into a work around discussed here - angular/universal#830.

I have Nebular UI running in SSR setup with domino. There are other minor issues associate with it, but nothing that stops the application from running. See my server.ts here - #402 . Hope it helps.

@khurram-wasim
Copy link
Author

I just successfully ran my application using domino
Thanks a bunch !

@tdespenza
Copy link

"So how did you use domino to resolve this? I'm just not getting this to work after upgrading to rc.10. It's specifically complaining about the theme module."

@nnixaa
Copy link
Collaborator

nnixaa commented Aug 13, 2018

Hi @tdespenza, you can open a new issue with the details of the issues you are having.

@tdespenza
Copy link

"@nnixaa I got it figured out.

I just used jsdom-global instead of domino."

@zambianchi
Copy link

Any fix available? the problem is still present with ssr.

@Ballpin
Copy link

Ballpin commented Oct 2, 2018

I found a solution for this. It is working for me, the nebular components just needs some modifications so it executes window.localStorage.getItem() only only if platform is browser.

Anyways here are the instructions.

  1. Move source to Angular Universal
  2. Follow @AnthonyNahas instructions in Angular 4 Universal - SyntaxError: Unexpected token export sebholstein/angular-google-maps#1052 for each plugin thats complaining about "Unexpected import".
  3. Use Domino if you need to. Normally is not suppose to be used because Node does not have window. Instead you are suppose to check if the platform is browser and then invoke localstorage in that if statement. See this link for more information

Note: After been trying to get his working for several hours. I learned that Angular Docs is missing several things for SSR thats why i chose to move source to Angular Universal Starter instead.

@neilhem
Copy link

neilhem commented Aug 30, 2019

There is also problem running in SSR because of window is not defined in intersection observer module

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

7 participants