From c8d9e545baf60ca67602a19c5139a779eca6600a Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Mon, 22 Apr 2019 17:05:35 +0100 Subject: [PATCH] feat(@ngtools/webpack): remove importFactories option It will just be always be used when applicable. --- packages/ngtools/webpack/src/angular_compiler_plugin.ts | 9 ++------- packages/ngtools/webpack/src/interfaces.ts | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/ngtools/webpack/src/angular_compiler_plugin.ts b/packages/ngtools/webpack/src/angular_compiler_plugin.ts index af6c6826c049..00eb74abc873 100644 --- a/packages/ngtools/webpack/src/angular_compiler_plugin.ts +++ b/packages/ngtools/webpack/src/angular_compiler_plugin.ts @@ -94,7 +94,6 @@ export class AngularCompilerPlugin { private _moduleResolutionCache: ts.ModuleResolutionCache; private _resourceLoader?: WebpackResourceLoader; private _discoverLazyRoutes = true; - private _importFactories = false; private _useFactories = false; // Contains `moduleImportPath#exportName` => `fullModulePath`. private _lazyRoutes: LazyRouteMap = {}; @@ -283,11 +282,6 @@ export class AngularCompilerPlugin { this._useFactories = true; } - if (this._useFactories && options.importFactories === true) { - // Only transform imports to use factories with View Engine. - this._importFactories = true; - } - // Default ContextElementDependency to the one we can import from here. // Failing to use the right ContextElementDependency will throw the error below: // "No module factory available for dependency type: ContextElementDependency" @@ -931,7 +925,8 @@ export class AngularCompilerPlugin { // Remove unneeded angular decorators. this._transformers.push(removeDecorators(isAppPath, getTypeChecker)); // Import ngfactory in loadChildren import syntax - if (this._importFactories) { + if (this._useFactories) { + // Only transform imports to use factories with View Engine. this._transformers.push(importFactory(msg => this._warnings.push(msg))); } } diff --git a/packages/ngtools/webpack/src/interfaces.ts b/packages/ngtools/webpack/src/interfaces.ts index 318e3ffdf082..606c336b38a4 100644 --- a/packages/ngtools/webpack/src/interfaces.ts +++ b/packages/ngtools/webpack/src/interfaces.ts @@ -49,7 +49,6 @@ export interface AngularCompilerPluginOptions { // When using Ivy, the string syntax is not supported at all. Thus we shouldn't attempt that. // This option is also used for when the compilation doesn't need this sort of processing at all. discoverLazyRoutes?: boolean; - importFactories?: boolean; // added to the list of lazy routes additionalLazyModules?: { [module: string]: string };