From 66851df87a9ed7fba8256b5d46521de158029ba4 Mon Sep 17 00:00:00 2001 From: Brenden Date: Sat, 26 May 2018 08:57:49 -0700 Subject: [PATCH] docs: update hmr documentation Update documentation for the hmr story to show proper configurations in angular.json and src/tsconfig.app.json. Closes #11028, #10668, #10663 --- docs/documentation/stories/configure-hmr.md | 35 +++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/docs/documentation/stories/configure-hmr.md b/docs/documentation/stories/configure-hmr.md index 978c25b3313a..0387b6810455 100644 --- a/docs/documentation/stories/configure-hmr.md +++ b/docs/documentation/stories/configure-hmr.md @@ -41,25 +41,48 @@ export const environment = { ``` -Update `angular.json` to include an hmr environment as explained [here](./application-environments) and add a configuration within serve to enable hmr. +Update `angular.json` to include an hmr environment as explained [here](./application-environments) +and add configurations within build and serve to enable hmr. Note that `` here +represents the name of the project you are adding this configuration to in `angular.json`. ```json - "serve": { - "configuration": { + "build": { + "configurations": { ... "hmr": { - "hmr": true, "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.hmr.ts" } - ], + ] + } + } + }, + ... + "serve": { + "configurations": { + ... + "hmr": { + "hmr": true, + "browserTarget": ":build:hmr" } } } ``` +Add the necessary types to `src/tsconfig.app.json` + +```json +{ + ... + "compilerOptions": { + ... + "types": ["node"] + }, +} +``` + Run `ng serve` with the flag `--configuration hmr` to enable hmr and select the new environment: ```bash @@ -134,7 +157,7 @@ if (environment.hmr) { console.log('Are you using the --hmr flag for ng serve?'); } } else { - bootstrap(); + bootstrap().catch(err => console.log(err)); } ```