-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add support for Angular Universal #230
Comments
Any updates on this? |
I followed the steps on https://angular.io/guide/universal, |
@creal73 is still working on this, Angular 6 may have changed some things regarding universal support so existing code needs to be adapted, stay tuned! |
Work is in feature/universal branch. Need to update the code using "Gotchas" to prevent window, localStorage, sessionStorage running on server side |
Any progress on this? Can you please consider adding pre-rendering scripts - something like "generate:prerender" in https://github.com/angular/universal-starter. |
Work is still in progress and any help is welcome ! I'll have a look on your suggestion by the end of the week |
Supporting SSR would be really great! I was converting the generated project into angular universal app and I faced some further problems related to this topic --> localstorage has been used without to check whether the app is running on the client or server side ... (todo) > cd dist && node prerender
Warning: Flex Layout loaded on the server without FlexLayoutServerModule
ERROR ReferenceError: localStorage is not defined
at I18nService.set [as language] (/Users/anthonnahas/..../dist/prerender.js:114732:36)
at I18nService../src/app/core/i18n.service.ts.I18nService.init (/Users/anthonnahas/.../dist/prerender.js:114712:23)
at AppComponent../src/app/app.component.ts.AppComponent.ngOnInit |
Yes, currently localStorage is used as part of the If would then simplify the work needed to make SSR working as a nice side-effect 😉 |
@sinedied I agree ;) |
My preference would go to NGXS, but given the difference between the 2 it would not be too much work to add both and give the choice :) |
I just crossed this bridge myself finally and I think there are some design decisions that should be made for this. I wanted to share some of the things I learned along the way here...
There may be other approaches to some of this, but after lots of trial and error this is what I settled on. Do you have any preferences? There are other little details too related to configuratons, directories, npm scripts, etc. But those are probably minor enough to deal with in a PR. |
I just noticed I missed that there's already a working branch 👏 woohoo. I wanted to add a couple things to the consideration of whether it's worthwhile to split the cordova and browser builds:
So I'm not sure the 2xxK savings is worthwhile for EVERYONE to justify the added complexity and build time after ng8 lands. But I do think having a separate module for non-server is pretty necessary for keeping misbehaving code off of the server. |
I like this idea a lot! 👍 One of the initial goal of this project was to keep the same codebase running for all target, so having distinct app modules for server/browser itch me a bit, but maybe that could not be avoided. |
:D believe me it itched me a lot too and I'm still applying ointment. After many unsuccessful workarounds (and 30 minute builds) to resist it, I finally gave up. Now my QA deployments take forever, but at least I can have SSR, service worker, and cordova builds living in harmony. I'll try to pitch in a bit on this when I have a chance. |
Any updates? |
No one is working on it at the moment unfortunately. |
Now that Angular Universal has landed and is properly supported through Angular CLI, we should also support it and provide an out-of-the-box DX for SSR (Server-Side Rendering).
Tasks:
server
angular app for SSRSee also https://github.com/angular/universal-starter for reference
The text was updated successfully, but these errors were encountered: