Angular-cli: adding support for platform-server (server-side rendering) using Angular CLI

Created on 21 Aug 2017  路  10Comments  路  Source: angular/angular-cli

- [ ] bug report -> please search issues before submitting
- [*] feature request

Versions.

@angular/cli: 1.3.1
node: 7.10.0
os: linux x64
@angular/animations: 4.3.5
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/core: 4.3.5
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/platform-server: 4.3.5
@angular/router: 4.3.5
@angular/cli: 1.3.1
@angular/compiler-cli: 4.3.5
@angular/language-service: 4.3.5

Feature request proposal

angular/universal has been merged into Angular 4.0, and we already know it as platform-server, and eveyone links to this directory to points out that universal lives inside Angular from now!
Unfortunately, the problem is there is no official documentation tutorial on angular.io website to clarify how to use platform-server, or what's the correct way to use platform-server, and users should struggle around to find an unofficial way to create their own server config, and other options to add server-side rendering for their website.
It's fine as long as they can run their app with platform-server support, but the problem is when it comes to a bigger community, we need to have a unified method of creating things for better support and faster development.
For that unified method of using platform-server, I think first of all the angular.io should write about platform-server as the official document of Angular, the other thing is that would be great if users could simply add support for platform-server simply by using Angular CLI.

The feature request I am asking for is a way to creating or adding support for platform-server using Angular CLI

Most helpful comment

Yeah, i'm waiting about a half year, for universal support from the box.
I don't understand why so demanded functionality is still ignoring by core team

All 10 comments

@glebmachine

Thanks for the comment, actually I followed that story in the Angular-cli doc, but I did not get the result I want (server-side rendering for search engine optimization, or better to say, views that are made in the server-side with the first request)

in the tutorial, they don't create a node server itself

@filipesilva any comments on this?

I know you've noticed the difficulty for Angular users too, I remember your comments on WebPack (the forgot a dependency) and that caused compiler error

Yeah, i'm waiting about a half year, for universal support from the box.
I don't understand why so demanded functionality is still ignoring by core team

This feature is still in experimentation. We're improving on it and will provide documentation on angular.io when it's ready. Right now the best we can provide is the story (see above, link here).

Please note that angular.io issues are tracked in the main repo (angular/angular).

@hansl Thanks for the comment.
May I know what do you mean "_This feature is still in experimentation_"?
Do you mean platform-server is in experimentation?

@hansl I follow the universal-rendering.md step by step...
but when I build the project I get and error of following the step 3 Step 3: Create a new project in .angular-cli.json
The error show me that when I add in the app array of angular-cli.json the server config
when I remove this there is no problem

Error output

InvalidConfigError: Parsing '/website/.angular-cli.json' failed. Ensure the file is valid JSON.

Version

"dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "core-js": "^2.4.1",
    "rxjs": "^5.4.2",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.3.2",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@angular/platform-server": "^4.2.4",
}

@pablocarreraest could you share your .angular-cli.json?

Is planned the platform="server" serve support? I have been checking the last changelogs but I can't see any about it.

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._

Was this page helpful?
0 / 5 - 0 ratings