Description
Bug Report or Feature Request (mark with an x
)
- [X] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x
)
- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [X] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [X] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
~> node --version
v8.11.1
~> npm --version
6.4.1-next.0
~> ng --version
Angular CLI: 6.0.8
Node: 8.11.1
OS: win32 x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cli 6.0.8
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.3.2
typescript 2.7.2
webpack 4.8.3
Repro steps
Following the tutorial app shell with ssr:
-
ng new my-app-shell --routing
-
ng generate universal ngu-app-shell --client-project my-app-shell
===> did not add a new application as mentioned in the tutorial, but did add a newserver
section underarchitect
section inangular.json
with following values
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/my-app-shell-server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
}
}
ng generate app-shell my-loading-shell --universal-project=ngu-app-shell --route=app-shell-path --client-project=my-app-shell
this addedapp-shell
section inangular.json
with belowoptions
"options": {
"browserTarget": "my-app-shell:build", <== I changed it to `my-app-shell:build:production`
"serverTarget": "my-app-shell:server",
"route": "app-shell-path"
}
-
ng run my-app-shell:app-shell
===> This pre-renderedapp-root
includingapp-my-loading-shell
. The expectation is that it pre-renders onlyapp-my-loading-shell
and once the DOM is fully loaded at the browser, the pre-rendered content is replaced by the actual angular app. -
npm install http-server --global
-
http-server -c-1 ./dist/my-app-shell
Observed behavior:
After step 6 mentioned above
a) localhost:8080
loads the index.html
from ./dist/my-app-shell
that contains both the app-root
and app-my-loading-shell
fully rendered
b) After the DOM is fully loaded (after downloading the whole app), there is no visible change in the browser.
Expected behavior:
a) localhost:8080
loads the index.html
from ./dist/my-app-shell
that contains only the app-my-loading-shell
fully rendered
b) After the DOM is fully loaded (after downloading the whole app), the contents of app-my-loading-shell
are replaced by the actual angular app app-root
.