Skip to content

Commit ce2c8d6

Browse files
devversionmmalerba
authored andcommitted
build: remove workaround for decorator metadata in universal-app (#19840)
In the past, Angular removed tsickle from the build pipeline. This meant that decorators were not downleveled, and executed immediately. This caused errors in SSR as parameters or input types are accessed on file load as runtime values. e.g. consider an input that used `HTMLElement` as type. The TypeScript decorator output would access `HTMLElement` on file load directly. This breaks on the server as such DOM specific globals do not exist there. We worked around this by providing global mocks for these symbols. Now with Angular v10 though, Angular processes decorators by default without requiring tsickle. This means that we can remove the workaround.
1 parent bcd9f63 commit ce2c8d6

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

src/universal-app/prerender.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
import 'reflect-metadata';
22
import 'zone.js';
33

4-
// We need to mock a few native DOM globals as those are not present on the server, but they
5-
// are required for decorator metadata. The View Engine compiler preserves Angular decorator
6-
// metadata in the JS output. This could mean for example that inputs which are typed to
7-
// `HTMLElement` break on the server, as the `__decorate` call requires the `HTMLElement`
8-
// global to be present. More details: https://github.com/angular/angular/issues/30586.
9-
(global as any).HTMLElement = {};
10-
(global as any).Event = {};
11-
(global as any).TransitionEvent = {};
12-
134
import {renderModuleFactory} from '@angular/platform-server';
145
import {readFileSync, writeFileSync} from 'fs';
156
import {join} from 'path';

0 commit comments

Comments
 (0)