Commit 263271f
committed
fix(@angular-devkit/build-angular): resolve and load sourcemaps during prerendering to provide better stacktraces
With this commit when running a build with sourcemaps enabled we enable Node.js Sourcemap support for stack traces.
See: https://nodejs.org/dist/latest/docs/api/cli.html#--enable-source-maps for more information about this feature.
Before
```
ERROR ReferenceError: window is not defined
at new _AppComponent (file:///chunk-HFZN2HE2.mjs:41631:19)
at NodeInjectorFactory.AppComponent_Factory [as factory] (file:///chunk-HFZN2HE2.mjs:41635:12)
at getNodeInjectable (file:///chunk-HFZN2HE2.mjs:6104:38)
at createRootComponent (file:///chunk-HFZN2HE2.mjs:10446:31)
at ComponentFactory.create (file:///chunk-HFZN2HE2.mjs:10348:19)
at _ApplicationRef.bootstrap (file:///chunk-HFZN2HE2.mjs:13247:40)
at file:///chunk-HFZN2HE2.mjs:12938:20
at _ZoneDelegate.invoke (file:///chunk-HFZN2HE2.mjs:320:158)
at Object.onInvoke (file:///chunk-HFZN2HE2.mjs:8562:25)
at _ZoneDelegate.invoke (file:///chunk-HFZN2HE2.mjs:320:46)
```
Now
```
ERROR ReferenceError: window is not defined
at constructor (/usr/xxxx/src/app/app.component.ts:16:17)
at NodeInjectorFactory.AppComponent_Factory (/usr/xxxx/src/app/app.component.ts:17:3)
at getNodeInjectable (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:4166:38)
at createRootComponent (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:14064:31)
at ComponentFactory.create (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:13931:19)
at _ApplicationRef.bootstrap (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:30650:40)
at <anonymous> (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:30163:20)
at _ZoneDelegate.invoke (/usr/xxxx/node_modules/zone.js/fesm2015/zone-node.js:344:158)
at Object.onInvoke (/usr/xxxx/node_modules/@angular/core/fesm2022/core.mjs:10964:25)
at _ZoneDelegate.invoke (/usr/xxxx/node_modules/zone.js/fesm2015/zone-node.js:344:46)
```
Closes #26013
(cherry picked from commit 0f45e21)1 parent 52f5956 commit 263271f
File tree
3 files changed
+82
-6
lines changed- packages/angular_devkit/build_angular/src
- builders/application
- utils/server-rendering
- tests/legacy-cli/e2e/tests/build/prerender
3 files changed
+82
-6
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
| |||
Lines changed: 36 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | | - | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
58 | 76 | | |
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
62 | 80 | | |
63 | 81 | | |
| 82 | + | |
64 | 83 | | |
65 | 84 | | |
66 | 85 | | |
| |||
76 | 95 | | |
77 | 96 | | |
78 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
79 | 103 | | |
80 | 104 | | |
81 | 105 | | |
| |||
85 | 109 | | |
86 | 110 | | |
87 | 111 | | |
88 | | - | |
| 112 | + | |
89 | 113 | | |
90 | 114 | | |
91 | 115 | | |
| |||
139 | 163 | | |
140 | 164 | | |
141 | 165 | | |
| 166 | + | |
142 | 167 | | |
143 | 168 | | |
144 | 169 | | |
| |||
160 | 185 | | |
161 | 186 | | |
162 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
163 | 193 | | |
164 | 194 | | |
165 | 195 | | |
| |||
169 | 199 | | |
170 | 200 | | |
171 | 201 | | |
172 | | - | |
| 202 | + | |
173 | 203 | | |
174 | 204 | | |
175 | 205 | | |
| |||
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
0 commit comments