angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Server rendering with angular-cli (universal as part of Angular)

Open ennyta opened this issue 9 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.0.6 node: 7.10.0 os: win32 x64 @angular/animations: 4.1.3 @angular/common: 4.1.3 @angular/compiler: 4.1.3 @angular/compiler-cli: 4.1.3 @angular/core: 4.1.3 @angular/forms: 4.1.3 @angular/http: 4.1.3 @angular/platform-browser: 4.1.3 @angular/platform-browser-dynamic: 4.1.3 @angular/platform-server: 4.1.3 @angular/router: 4.1.3 @angular/cli: 1.0.6 @ngtools/webpack: 1.4.0

Repro steps.

Using angular-cli, follow Angular guides for server rendering from https://angular.io/docs/ts/latest/guide/universal.html, build hangs forever.

The log given by the failure.

npm run build:uni

[email protected] build:uni project_path webpack --config webpack.config.uni.js And then hangs forever.

Desired functionality.

According to https://angular.io/docs/ts/latest/guide/universal.html, building the project with npm run build:uni, which is running "webpack --config webpack.config.uni.js" should finish the build with server side rendering successfully.

Mention any other details that might be useful.

Angular universal is part of Angular and following their guidelines, project should build. Running the same on angular example project builds successfully. Does anyone have experience in configuring server rendering build with angular-cli project? Is there some additional configuration maybe missing or is it a whole new feature for angular-cli?

Any help would be appreciated.

ennyta avatar Jun 01 '17 13:06 ennyta

The instructions shown in https://angular.io/docs/ts/latest/guide/universal.html are unfortunately not applicable to Angular CLI projects. We're working on adding some warnings stating this to the guides such as that one.

Angular CLI does not yet support projects using universal. Progress for that is being tracked in https://github.com/angular/angular-cli/issues/1050.

filipesilva avatar Jun 06 '17 12:06 filipesilva

Hi Chaps, I have been part of the beta for a pre-render hosting service which means zero config for angular universal!!!!!

Just build with angular cli and deploy using roast. CDN, Amazon servers, redirects, and also a proxy for using external API's. Sit back put your feet up and hit deploy.

I am not affiliated whatsoever.

https://www.roast.io/

borntodesign avatar Jun 27 '17 08:06 borntodesign

@borntodesign seems awesome, does it work with pages that make http calls to api to fetch data i.e. in ngOnInit?

naveedahmed1 avatar Sep 03 '17 14:09 naveedahmed1

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.