Commit 51f6927
feat(@angular/build): enable chunk optimization for server builds
The chunk optimization pass was disabled when a server entry point was
present due to a concern that renamed browser chunks would cause incorrect
preloading. The preload metadata (route tree preload arrays and
entryPointToBrowserMapping in the server app manifest) is generated after
the optimization pass from the optimized metafile, so renamed and merged
chunks stay consistent with the emitted files.
A behavior test now asserts that the server manifest only references
browser chunks that exist after optimization and that every lazy route
retains its entry point mapping. The server-routes-preload-links e2e test
now verifies that every route of an optimized build emits preload links
that resolve successfully, instead of only checking the root route.1 parent 2462709 commit 51f6927Copy full SHA for 51f6927
3 files changed
+208-22Lines changed: 208 additions & 22 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- packages/angular/build/src/builders/application
- tests/behavior
- tests/e2e/tests/build/server-rendering
Expand file treeCollapse file tree
Open diff view settings
Collapse file
packages/angular/build/src/builders/application/execute-build.ts
Copy file name to clipboardExpand all lines: packages/angular/build/src/builders/application/execute-build.ts+1-4Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
175 | 175 | |
176 | 176 | |
177 | 177 | |
178 | | - |
179 | | - |
180 | | - |
181 | | - |
| 178 | + |
182 | 179 | |
183 | 180 | |
184 | 181 | |
|
Collapse file
packages/angular/build/src/builders/application/tests/behavior/chunk-optimization-server_spec.ts
Copy file name to clipboard+187Lines changed: 187 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 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
Collapse file
tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts
Copy file name to clipboardExpand all lines: tests/e2e/tests/build/server-rendering/server-routes-preload-links.ts+20-18Lines changed: 20 additions & 18 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
117 | 117 | |
118 | 118 | |
119 | 119 | |
120 | | - |
121 | | - |
| 120 | + |
122 | 121 | |
123 | 122 | |
124 | 123 | |
125 | 124 | |
126 | 125 | |
127 | 126 | |
128 | 127 | |
129 | | - |
130 | 128 | |
131 | | - |
132 | | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
| 129 | + |
141 | 130 | |
142 | 131 | |
143 | 132 | |
| ||
189 | 178 | |
190 | 179 | |
191 | 180 | |
192 | | - |
193 | | - |
194 | | - |
195 | | - |
196 | | - |
197 | 181 | |
198 | 182 | |
199 | 183 | |
| ||
203 | 187 | |
204 | 188 | |
205 | 189 | |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
206 | 208 | |
207 | 209 | |
208 | 210 | |
|
0 commit comments