Skip to content

Remove experimentalImportFactories #14231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions packages/angular/cli/lib/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export interface BuildOptions {
forkTypeChecker: boolean;
profile?: boolean;
es5BrowserSupport?: boolean;
experimentalImportFactories?: boolean;

main: string;
index: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ function _createAotPlugin(
contextElementDependencyConstructor: require('webpack/lib/dependencies/ContextElementDependency'),
logger: wco.logger,
directTemplateLoading: true,
importFactories: buildOptions.experimentalImportFactories,
...options,
};

Expand Down
5 changes: 0 additions & 5 deletions packages/angular_devkit/build_angular/src/browser/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
9 changes: 2 additions & 7 deletions packages/ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)));
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/ngtools/webpack/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
7 changes: 0 additions & 7 deletions tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)`);

Expand Down