Skip to content

Commit ff2bd3e

Browse files
bniedermeyerfilipesilva
authored andcommitted
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
1 parent 4ba67ee commit ff2bd3e

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

docs/documentation/stories/configure-hmr.md

+29-6
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,48 @@ export const environment = {
4141
```
4242

4343

44-
Update `angular.json` to include an hmr environment as explained [here](./application-environments) and add a configuration within serve to enable hmr.
44+
Update `angular.json` to include an hmr environment as explained [here](./application-environments)
45+
and add configurations within build and serve to enable hmr. Note that `<project-name>` here
46+
represents the name of the project you are adding this configuration to in `angular.json`.
4547

4648
```json
47-
"serve": {
48-
"configuration": {
49+
"build": {
50+
"configurations": {
4951
...
5052
"hmr": {
51-
"hmr": true,
5253
"fileReplacements": [
5354
{
5455
"replace": "src/environments/environment.ts",
5556
"with": "src/environments/environment.hmr.ts"
5657
}
57-
],
58+
]
59+
}
60+
}
61+
},
62+
...
63+
"serve": {
64+
"configurations": {
65+
...
66+
"hmr": {
67+
"hmr": true,
68+
"browserTarget": "<project-name>:build:hmr"
5869
}
5970
}
6071
}
6172
```
6273

74+
Add the necessary types to `src/tsconfig.app.json`
75+
76+
```json
77+
{
78+
...
79+
"compilerOptions": {
80+
...
81+
"types": ["node"]
82+
},
83+
}
84+
```
85+
6386
Run `ng serve` with the flag `--configuration hmr` to enable hmr and select the new environment:
6487

6588
```bash
@@ -134,7 +157,7 @@ if (environment.hmr) {
134157
console.log('Are you using the --hmr flag for ng serve?');
135158
}
136159
} else {
137-
bootstrap();
160+
bootstrap().catch(err => console.log(err));
138161
}
139162
```
140163

0 commit comments

Comments
 (0)