From 9eba2ccc08fff93943d76901c9dfebe01544c876 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Wed, 6 Nov 2019 16:18:52 +0000 Subject: [PATCH] fix(@ngtools/webpack): only remove decorators in VE Fix #16070 --- packages/ngtools/webpack/src/angular_compiler_plugin.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/ngtools/webpack/src/angular_compiler_plugin.ts b/packages/ngtools/webpack/src/angular_compiler_plugin.ts index 6891427808e5..376bb1631af5 100644 --- a/packages/ngtools/webpack/src/angular_compiler_plugin.ts +++ b/packages/ngtools/webpack/src/angular_compiler_plugin.ts @@ -981,8 +981,11 @@ export class AngularCompilerPlugin { // This is required to support forwardRef in ES2015 due to TDZ issues this._transformers.push(downlevelConstructorParameters(getTypeChecker)); } else { - // Remove unneeded angular decorators. - this._transformers.push(removeDecorators(isAppPath, getTypeChecker)); + if (!this._compilerOptions.enableIvy) { + // Remove unneeded angular decorators in VE. + // In Ivy they are removed in ngc directly. + this._transformers.push(removeDecorators(isAppPath, getTypeChecker)); + } // Import ngfactory in loadChildren import syntax if (this._useFactories) { // Only transform imports to use factories with View Engine.