Skip to content

Commit 3660a2e

Browse files
committed
fix(@ngtools/webpack): remove compiler workarounds
These issues were fixed in Angular 5.0.0-rc.7.
1 parent 8c10375 commit 3660a2e

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

packages/@ngtools/webpack/src/angular_compiler_plugin.ts

+12-26
Original file line numberDiff line numberDiff line change
@@ -372,26 +372,19 @@ export class AngularCompilerPlugin implements Tapable {
372372
} else {
373373
time('AngularCompilerPlugin._createOrUpdateProgram.ng.createProgram');
374374
// Create the Angular program.
375-
try {
376-
this._program = createProgram({
377-
rootNames: this._tsFilenames,
378-
options: this._angularCompilerOptions,
379-
host: this._angularCompilerHost,
380-
oldProgram: this._program as Program
375+
this._program = createProgram({
376+
rootNames: this._tsFilenames,
377+
options: this._angularCompilerOptions,
378+
host: this._angularCompilerHost,
379+
oldProgram: this._program as Program
380+
});
381+
timeEnd('AngularCompilerPlugin._createOrUpdateProgram.ng.createProgram');
382+
383+
time('AngularCompilerPlugin._createOrUpdateProgram.ng.loadNgStructureAsync');
384+
return this._program.loadNgStructureAsync()
385+
.then(() => {
386+
timeEnd('AngularCompilerPlugin._createOrUpdateProgram.ng.loadNgStructureAsync');
381387
});
382-
timeEnd('AngularCompilerPlugin._createOrUpdateProgram.ng.createProgram');
383-
384-
time('AngularCompilerPlugin._createOrUpdateProgram.ng.loadNgStructureAsync');
385-
return this._program.loadNgStructureAsync()
386-
.then(() => {
387-
timeEnd('AngularCompilerPlugin._createOrUpdateProgram.ng.loadNgStructureAsync');
388-
});
389-
} catch (e) {
390-
// TODO: remove this when the issue is addressed.
391-
// Temporary workaround for https://github.com/angular/angular/issues/19951
392-
this._program = undefined;
393-
throw e;
394-
}
395388
}
396389
})
397390
.then(() => {
@@ -731,10 +724,6 @@ export class AngularCompilerPlugin implements Tapable {
731724
const changedTsFiles = this._getChangedTsFiles();
732725
if (this._ngCompilerSupportsNewApi) {
733726
this._processLazyRoutes(this._listLazyRoutesFromProgram());
734-
// TODO: remove this when the issue is addressed.
735-
// Fix for a bug in compiler where the program needs to be updated after
736-
// _listLazyRoutesFromProgram is called.
737-
return this._createOrUpdateProgram();
738727
} else if (this._firstRun) {
739728
this._processLazyRoutes(this._getLazyRoutesFromNgtools());
740729
} else if (changedTsFiles.length > 0) {
@@ -1002,9 +991,6 @@ export class AngularCompilerPlugin implements Tapable {
1002991
this.writeI18nOutFile();
1003992
}
1004993
timeEnd('AngularCompilerPlugin._emit.ng.emit');
1005-
} else {
1006-
// Throw away the old program if there was an error.
1007-
this._program = undefined;
1008994
}
1009995
}
1010996
} catch (e) {

0 commit comments

Comments
 (0)