diff --git a/packages/angular/cli/lib/config/schema.json b/packages/angular/cli/lib/config/schema.json index 230b2faac391..cd0b2b193e6c 100644 --- a/packages/angular/cli/lib/config/schema.json +++ b/packages/angular/cli/lib/config/schema.json @@ -886,11 +886,6 @@ "webWorkerTsConfig": { "type": "string", "description": "TypeScript configuration for Web Worker modules." - }, - "experimentalImportFactories": { - "description": "**EXPERIMENTAL** Transform import statements for lazy routes to import factories when using View Engine. Should only be used when switching back and forth between View Engine and Ivy. See https://angular.io/guide/ivy for usage information.", - "type": "boolean", - "default": false } }, "additionalProperties": false, diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/build-options.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/build-options.ts index 53591aae038d..a2a8652e294e 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/build-options.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/build-options.ts @@ -60,7 +60,6 @@ export interface BuildOptions { forkTypeChecker: boolean; profile?: boolean; es5BrowserSupport?: boolean; - experimentalImportFactories?: boolean; main: string; index: string; diff --git a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/typescript.ts b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/typescript.ts index 5e92c917ac91..9965a34c1f33 100644 --- a/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/typescript.ts +++ b/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/typescript.ts @@ -91,7 +91,6 @@ function _createAotPlugin( contextElementDependencyConstructor: require('webpack/lib/dependencies/ContextElementDependency'), logger: wco.logger, directTemplateLoading: true, - importFactories: buildOptions.experimentalImportFactories, ...options, }; diff --git a/packages/angular_devkit/build_angular/src/browser/schema.json b/packages/angular_devkit/build_angular/src/browser/schema.json index 6473d01c8feb..fa4876246630 100644 --- a/packages/angular_devkit/build_angular/src/browser/schema.json +++ b/packages/angular_devkit/build_angular/src/browser/schema.json @@ -316,11 +316,6 @@ "default": false, "x-deprecated": true }, - "experimentalImportFactories": { - "description": "**EXPERIMENTAL** Transform import statements for lazy routes to import factories when using View Engine. Should only be used when switching back and forth between View Engine and Ivy. See https://angular.io/guide/ivy for usage information.", - "type": "boolean", - "default": false - }, "webWorkerTsConfig": { "type": "string", "description": "TypeScript configuration for Web Worker modules." 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 }; diff --git a/tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts b/tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts index 826747136718..2a38e84cc83a 100644 --- a/tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts +++ b/tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts @@ -89,13 +89,6 @@ export default async function () { await ng('e2e', '--prod'); // Test `import()` style lazy load. - if (!ivyProject) { - await updateJsonFile('angular.json', json => { - // Add the experimental flag to import factories in View Engine. - const buildTarget = json['projects'][projectName]['architect']['build']; - buildTarget['options']['experimentalImportFactories'] = true; - }); - } // Both Ivy and View Engine should support it. await replaceLoadChildren(`() => import('./lazy/lazy.module').then(m => m.LazyModule)`);