You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation/stories/configure-hmr.md
+29-6
Original file line number
Diff line number
Diff line change
@@ -41,25 +41,48 @@ export const environment = {
41
41
```
42
42
43
43
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`.
45
47
46
48
```json
47
-
"serve": {
48
-
"configuration": {
49
+
"build": {
50
+
"configurations": {
49
51
...
50
52
"hmr": {
51
-
"hmr": true,
52
53
"fileReplacements": [
53
54
{
54
55
"replace": "src/environments/environment.ts",
55
56
"with": "src/environments/environment.hmr.ts"
56
57
}
57
-
],
58
+
]
59
+
}
60
+
}
61
+
},
62
+
...
63
+
"serve": {
64
+
"configurations": {
65
+
...
66
+
"hmr": {
67
+
"hmr": true,
68
+
"browserTarget": "<project-name>:build:hmr"
58
69
}
59
70
}
60
71
}
61
72
```
62
73
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
+
63
86
Run `ng serve` with the flag `--configuration hmr` to enable hmr and select the new environment:
64
87
65
88
```bash
@@ -134,7 +157,7 @@ if (environment.hmr) {
134
157
console.log('Are you using the --hmr flag for ng serve?');
0 commit comments