diff --git a/packages/core/schematics/migrations/static-queries/strategies/template_strategy/template_strategy.ts b/packages/core/schematics/migrations/static-queries/strategies/template_strategy/template_strategy.ts index 4028d01866..ba354de43a 100644 --- a/packages/core/schematics/migrations/static-queries/strategies/template_strategy/template_strategy.ts +++ b/packages/core/schematics/migrations/static-queries/strategies/template_strategy/template_strategy.ts @@ -11,7 +11,6 @@ import {Diagnostic, createProgram, readConfiguration} from '@angular/compiler-cl import {resolve} from 'path'; import * as ts from 'typescript'; -import {hasPropertyNameText} from '../../../../utils/typescript/property_name'; import {ClassMetadataMap} from '../../angular/ng_query_visitor'; import {NgQueryDefinition, QueryTiming, QueryType} from '../../angular/query-definition'; import {TimingResult, TimingStrategy} from '../timing-strategy'; @@ -34,6 +33,13 @@ export class QueryTemplateStrategy implements TimingStrategy { */ setup() { const {rootNames, options} = readConfiguration(this.projectPath); + + // https://github.com/angular/angular/commit/ec4381dd401f03bded652665b047b6b90f2b425f made Ivy + // the default. This breaks the assumption that "createProgram" from compiler-cli returns the + // NGC program. In order to ensure that the migration runs properly, we set "enableIvy" to + // false. + options.enableIvy = false; + const aotProgram = createProgram({rootNames, options, host: this.host}); // The "AngularCompilerProgram" does not expose the "AotCompiler" instance, nor does it diff --git a/packages/core/schematics/test/static_queries_migration_template_spec.ts b/packages/core/schematics/test/static_queries_migration_template_spec.ts index 638b15186a..cce1b34bee 100644 --- a/packages/core/schematics/test/static_queries_migration_template_spec.ts +++ b/packages/core/schematics/test/static_queries_migration_template_spec.ts @@ -31,7 +31,6 @@ describe('static-queries migration with template strategy', () => { experimentalDecorators: true, lib: ['es2015'], }, - angularCompilerOptions: {enableIvy: false} })); writeFile('/angular.json', JSON.stringify({ projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}} @@ -682,7 +681,6 @@ describe('static-queries migration with template strategy', () => { angularCompilerOptions: { flatModuleId: 'flat-module', flatModuleOutFile: 'flat-module-bundle.js', - enableIvy: false, }, files: ['index.ts'] }));